This commit is contained in:
MacRimi 2025-03-01 18:46:22 +01:00
parent 46021474f3
commit 472de46657
4 changed files with 253 additions and 112 deletions

View File

@ -1,5 +1,6 @@
import type { Metadata } from "next" import type { Metadata } from "next"
import { Settings } from "lucide-react" import { Settings } from "lucide-react"
import { CopyableCode } from "@/components/CopyableCode"
export const metadata: Metadata = { export const metadata: Metadata = {
title: "ProxMenux Post-Install: Basic Settings", title: "ProxMenux Post-Install: Basic Settings",
@ -31,32 +32,61 @@ export const metadata: Metadata = {
export default function BasicSettingsPage() { export default function BasicSettingsPage() {
const installUtilitiesCode = ` const installUtilitiesCode = `
# Update package lists
sudo apt-get update sudo apt-get update
sudo apt-get install -y axel curl dialog dnsutils dos2unix gnupg-agent grc htop btop iftop iotop \\
iperf3 ipset iptraf-ng mlocate msr-tools nano net-tools omping \\ # Install common system utilities
software-properties-common sshpass tmux unzip vim vim-nox wget whois zip \\ sudo apt-get install -y axel curl dialog dnsutils dos2unix gnupg-agent grc htop btop iftop iotop
libguestfs-tools sudo apt-get install -y iperf3 ipset iptraf-ng mlocate msr-tools nano net-tools omping
sudo apt-get install -y software-properties-common sshpass tmux unzip vim vim-nox wget whois zip
sudo apt-get install -y libguestfs-tools
` `
const skipLanguagesCode = ` const skipLanguagesCode = `
# Configure APT to skip downloading additional languages
echo 'Acquire::Languages "none";' | sudo tee /etc/apt/apt.conf.d/99-disable-translations echo 'Acquire::Languages "none";' | sudo tee /etc/apt/apt.conf.d/99-disable-translations
` `
const timeSyncCode = ` const timeSyncCode = `
# To set timezone automatically based on IP, you would need to run: # Set timezone (replace 'America/New_York' with your timezone)
IP=$(dig +short myip.opendns.com @resolver1.opendns.com) sudo timedatectl set-timezone America/New_York
TIMEZONE=$(curl -s "https://ipapi.co/$IP/timezone")
sudo timedatectl set-timezone "$TIMEZONE" # Enable automatic time synchronization
sudo timedatectl set-ntp true
# Note: To set timezone automatically based on IP, you can use:
# IP=$(dig +short myip.opendns.com @resolver1.opendns.com)
# TIMEZONE=$(curl -s "https://ipapi.co/$IP/timezone")
# sudo timedatectl set-timezone "$TIMEZONE"
` `
const updateUpgradeCode = ` const updateUpgradeCode = `
# Disable enterprise repos # Disable enterprise Proxmox repository
sudo sed -i 's/^deb/#deb/g' /etc/apt/sources.list.d/pve-enterprise.list if [ -f /etc/apt/sources.list.d/pve-enterprise.list ]; then
sudo sed -i 's/^deb/#deb/g' /etc/apt/sources.list.d/ceph.list sudo sed -i 's/^deb/#deb/g' /etc/apt/sources.list.d/pve-enterprise.list
fi
# Enable free public repo # Disable enterprise Proxmox Ceph repository
if [ -f /etc/apt/sources.list.d/ceph.list ]; then
sudo sed -i 's/^deb/#deb/g' /etc/apt/sources.list.d/ceph.list
fi
# Enable free public Proxmox repository
echo "deb http://download.proxmox.com/debian/pve $(lsb_release -cs) pve-no-subscription" | sudo tee /etc/apt/sources.list.d/pve-public-repo.list echo "deb http://download.proxmox.com/debian/pve $(lsb_release -cs) pve-no-subscription" | sudo tee /etc/apt/sources.list.d/pve-public-repo.list
# Enable Proxmox testing repository
echo "deb http://download.proxmox.com/debian/pve $(lsb_release -cs) pvetest" | sudo tee /etc/apt/sources.list.d/pve-testing-repo.list
# Configure main Debian repositories
cat <<EOF | sudo tee /etc/apt/sources.list
deb http://deb.debian.org/debian $(lsb_release -cs) main contrib non-free non-free-firmware
deb http://deb.debian.org/debian $(lsb_release -cs)-updates main contrib non-free non-free-firmware
deb http://security.debian.org/debian-security $(lsb_release -cs)-security main contrib non-free non-free-firmware
EOF
# Disable non-free firmware warnings
echo 'APT::Get::Update::SourceListWarnings::NonFreeFirmware "false";' | sudo tee /etc/apt/apt.conf.d/no-bookworm-firmware.conf
# Update and upgrade # Update and upgrade
sudo apt-get update sudo apt-get update
sudo apt-get dist-upgrade -y sudo apt-get dist-upgrade -y
@ -92,10 +122,8 @@ sudo apt-get install -y zfsutils-linux proxmox-backup-restore-image chrony
Proxmox VE system. They provide essential tools for monitoring system performance, managing files, and Proxmox VE system. They provide essential tools for monitoring system performance, managing files, and
troubleshooting issues, enhancing your ability to maintain and optimize your virtualization environment. troubleshooting issues, enhancing your ability to maintain and optimize your virtualization environment.
</p> </p>
<h4 className="text-lg font-semibold mb-2">To apply this optimization manually, you would run:</h4> <h4 className="text-lg font-semibold mb-2">To apply this optimization manually, run these commands:</h4>
<pre className="bg-gray-100 p-4 rounded-md overflow-x-auto"> <CopyableCode code={installUtilitiesCode} />
<code>{installUtilitiesCode}</code>
</pre>
</section> </section>
<section className="mb-8"> <section className="mb-8">
@ -109,10 +137,8 @@ sudo apt-get install -y zfsutils-linux proxmox-backup-restore-image chrony
improve the speed of package management operations. This is particularly useful in server environments where improve the speed of package management operations. This is particularly useful in server environments where
multiple language support is often not required. multiple language support is often not required.
</p> </p>
<h4 className="text-lg font-semibold mb-2">To apply this optimization manually, you would run:</h4> <h4 className="text-lg font-semibold mb-2">To apply this optimization manually, run this command:</h4>
<pre className="bg-gray-100 p-4 rounded-md overflow-x-auto"> <CopyableCode code={skipLanguagesCode} />
<code>{skipLanguagesCode}</code>
</pre>
</section> </section>
<section className="mb-8"> <section className="mb-8">
@ -125,27 +151,31 @@ sudo apt-get install -y zfsutils-linux proxmox-backup-restore-image chrony
consistency, and proper functioning of time-sensitive applications. Automatic synchronization ensures your consistency, and proper functioning of time-sensitive applications. Automatic synchronization ensures your
Proxmox VE system maintains the correct time without manual intervention. Proxmox VE system maintains the correct time without manual intervention.
</p> </p>
<h4 className="text-lg font-semibold mb-2">To apply this optimization manually, you would run:</h4> <h4 className="text-lg font-semibold mb-2">To apply this optimization manually, run these commands:</h4>
<pre className="bg-gray-100 p-4 rounded-md overflow-x-auto"> <CopyableCode code={timeSyncCode} />
<code>{timeSyncCode}</code>
</pre>
</section> </section>
<section className="mb-8"> <section className="mb-8">
<h3 className="text-xl font-semibold mb-2">4. Update and Upgrade System</h3> <h3 className="text-xl font-semibold mb-2">4. Update and Upgrade System</h3>
<p className="mb-4"> <p className="mb-4">
This optimization updates the system's package lists, upgrades installed packages, and configures Proxmox This optimization updates the system's package lists, upgrades installed packages, and configures Proxmox
repositories. repositories. It also includes additional steps to properly set up Debian repositories and disable certain
warnings.
</p> </p>
<p className="mb-4"> <p className="mb-4">
<strong>Why it's beneficial:</strong> Keeping your system up-to-date is essential for security, stability, and <strong>Why it's beneficial:</strong> Keeping your system up-to-date is essential for security, stability, and
performance. This optimization ensures you have the latest patches and features, while also configuring the performance. This optimization ensures you have the latest patches and features, while also configuring the
correct repositories for Proxmox VE, enabling access to necessary updates and tools. correct repositories for Proxmox VE, enabling access to necessary updates and tools. The additional steps help
in:
</p> </p>
<h4 className="text-lg font-semibold mb-2">To apply this optimization manually, you would run:</h4> <ul className="list-disc pl-5 mb-4">
<pre className="bg-gray-100 p-4 rounded-md overflow-x-auto"> <li>Disabling enterprise repositories to avoid conflicts</li>
<code>{updateUpgradeCode}</code> <li>Enabling free and testing repositories for broader package access</li>
</pre> <li>Properly configuring Debian repositories for a stable system</li>
<li>Suppressing non-free firmware warnings for a cleaner update experience</li>
</ul>
<h4 className="text-lg font-semibold mb-2">To apply this optimization manually, run these commands:</h4>
<CopyableCode code={updateUpgradeCode} />
</section> </section>
<section className="mt-12 p-4 bg-blue-100 rounded-md"> <section className="mt-12 p-4 bg-blue-100 rounded-md">
@ -153,7 +183,8 @@ sudo apt-get install -y zfsutils-linux proxmox-backup-restore-image chrony
<p> <p>
All of these optimizations are automatically applied when selected in the Basic Settings section of the All of these optimizations are automatically applied when selected in the Basic Settings section of the
customizable_post_install.sh script. This automation ensures that these beneficial settings are applied customizable_post_install.sh script. This automation ensures that these beneficial settings are applied
consistently and correctly. consistently and correctly, saving time and reducing the potential for human error during manual
configuration.
</p> </p>
</section> </section>
</div> </div>

View File

@ -1,5 +1,6 @@
import type { Metadata } from "next" import type { Metadata } from "next"
import { Network } from "lucide-react" import { Network } from "lucide-react"
import { CopyableCode } from "@/components/CopyableCode"
export const metadata: Metadata = { export const metadata: Metadata = {
title: "ProxMenux Post-Install: Network Settings", title: "ProxMenux Post-Install: Network Settings",
@ -38,12 +39,45 @@ net.core.optmem_max=8192
net.core.rmem_max=16777216 net.core.rmem_max=16777216
net.core.somaxconn=8151 net.core.somaxconn=8151
net.core.wmem_max=16777216 net.core.wmem_max=16777216
net.ipv4.tcp_rmem=8192 87380 16777216 net.ipv4.conf.all.accept_redirects = 0
net.ipv4.tcp_wmem=8192 65536 16777216 net.ipv4.conf.all.accept_source_route = 0
net.ipv4.conf.all.log_martians = 0
net.ipv4.conf.all.rp_filter = 1
net.ipv4.conf.all.secure_redirects = 0
net.ipv4.conf.all.send_redirects = 0
net.ipv4.conf.default.accept_redirects = 0
net.ipv4.conf.default.accept_source_route = 0
net.ipv4.conf.default.log_martians = 0
net.ipv4.conf.default.rp_filter = 1
net.ipv4.conf.default.secure_redirects = 0
net.ipv4.conf.default.send_redirects = 0
net.ipv4.icmp_echo_ignore_broadcasts = 1
net.ipv4.icmp_ignore_bogus_error_responses = 1
net.ipv4.ip_local_port_range=1024 65535
net.ipv4.tcp_base_mss = 1024
net.ipv4.tcp_challenge_ack_limit = 999999999
net.ipv4.tcp_fin_timeout=10
net.ipv4.tcp_keepalive_intvl=30
net.ipv4.tcp_keepalive_probes=3
net.ipv4.tcp_keepalive_time=240
net.ipv4.tcp_limit_output_bytes=65536
net.ipv4.tcp_max_syn_backlog=8192 net.ipv4.tcp_max_syn_backlog=8192
net.ipv4.tcp_max_tw_buckets = 1440000
net.ipv4.tcp_mtu_probing = 1
net.ipv4.tcp_rfc1337=1
net.ipv4.tcp_rmem=8192 87380 16777216
net.ipv4.tcp_sack=1
net.ipv4.tcp_slow_start_after_idle=0 net.ipv4.tcp_slow_start_after_idle=0
net.ipv4.tcp_tw_reuse=0 net.ipv4.tcp_syn_retries=3
# ... (other network optimizations) net.ipv4.tcp_synack_retries = 2
net.ipv4.tcp_tw_recycle = 0
net.ipv4.tcp_tw_reuse = 0
net.ipv4.tcp_wmem=8192 65536 16777216
net.netfilter.nf_conntrack_generic_timeout = 60
net.netfilter.nf_conntrack_helper=0
net.netfilter.nf_conntrack_max = 524288
net.netfilter.nf_conntrack_tcp_timeout_established = 28800
net.unix.max_dgram_qlen = 4096
EOF EOF
# Apply sysctl changes # Apply sysctl changes
@ -77,8 +111,10 @@ echo "Acquire::ForceIPv4 \"true\";" > /etc/apt/apt.conf.d/99-force-ipv4
` `
const installOpenVSwitchCode = ` const installOpenVSwitchCode = `
# Install OpenVSwitch # Update package lists
apt-get update apt-get update
# Install OpenVSwitch
apt-get install -y openvswitch-switch openvswitch-common apt-get install -y openvswitch-switch openvswitch-common
# Verify installation # Verify installation
@ -105,12 +141,18 @@ ovs-vsctl --version
</p> </p>
<p className="mb-4"> <p className="mb-4">
<strong>Why it's beneficial:</strong> These optimizations can significantly improve network throughput, reduce <strong>Why it's beneficial:</strong> These optimizations can significantly improve network throughput, reduce
latency, and enhance security by adjusting various kernel parameters related to networking. latency, and enhance security by adjusting various kernel parameters related to networking. Some key benefits
include:
</p> </p>
<ul className="list-disc pl-5 mb-4">
<li>Increased maximum number of backlog connections</li>
<li>Optimized TCP window sizes for better throughput</li>
<li>Enhanced security by disabling potentially dangerous features like ICMP redirects</li>
<li>Improved TCP connection handling and timeout settings</li>
<li>Optimized network memory allocation</li>
</ul>
<h4 className="text-lg font-semibold mb-2">To apply this optimization manually, you would run:</h4> <h4 className="text-lg font-semibold mb-2">To apply this optimization manually, you would run:</h4>
<pre className="bg-gray-100 p-4 rounded-md overflow-x-auto"> <CopyableCode code={applyNetworkOptimizationsCode} />
<code>{applyNetworkOptimizationsCode}</code>
</pre>
</section> </section>
<section className="mb-8"> <section className="mb-8">
@ -119,14 +161,20 @@ ovs-vsctl --version
This optimization enables Google's TCP BBR congestion control algorithm and TCP Fast Open. This optimization enables Google's TCP BBR congestion control algorithm and TCP Fast Open.
</p> </p>
<p className="mb-4"> <p className="mb-4">
<strong>Why it's beneficial:</strong> TCP BBR can significantly improve network throughput and reduce latency, <strong>Why it's beneficial:</strong>
especially on long-distance or congested networks. TCP Fast Open reduces connection establishment time,
improving the speed of short-lived connections.
</p> </p>
<ul className="list-disc pl-5 mb-4">
<li>
TCP BBR (Bottleneck Bandwidth and Round-trip propagation time) can significantly improve network throughput
and reduce latency, especially on long-distance or congested networks.
</li>
<li>
TCP Fast Open reduces connection establishment time, improving the speed of short-lived connections by
allowing data transfer during the initial TCP handshake.
</li>
</ul>
<h4 className="text-lg font-semibold mb-2">To apply this optimization manually, you would run:</h4> <h4 className="text-lg font-semibold mb-2">To apply this optimization manually, you would run:</h4>
<pre className="bg-gray-100 p-4 rounded-md overflow-x-auto"> <CopyableCode code={enableTcpFastOpenCode} />
<code>{enableTcpFastOpenCode}</code>
</pre>
</section> </section>
<section className="mb-8"> <section className="mb-8">
@ -134,12 +182,15 @@ ovs-vsctl --version
<p className="mb-4">This optimization configures APT (Advanced Package Tool) to use IPv4 exclusively.</p> <p className="mb-4">This optimization configures APT (Advanced Package Tool) to use IPv4 exclusively.</p>
<p className="mb-4"> <p className="mb-4">
<strong>Why it's beneficial:</strong> Forcing APT to use IPv4 can resolve issues in environments where IPv6 is <strong>Why it's beneficial:</strong> Forcing APT to use IPv4 can resolve issues in environments where IPv6 is
not properly configured or is causing slowdowns. This ensures more reliable package management operations. not properly configured or is causing slowdowns. This ensures more reliable package management operations by:
</p> </p>
<ul className="list-disc pl-5 mb-4">
<li>Avoiding potential IPv6-related connection issues</li>
<li>Ensuring consistent behavior across different network configurations</li>
<li>Potentially speeding up package downloads in networks with suboptimal IPv6 support</li>
</ul>
<h4 className="text-lg font-semibold mb-2">To apply this optimization manually, you would run:</h4> <h4 className="text-lg font-semibold mb-2">To apply this optimization manually, you would run:</h4>
<pre className="bg-gray-100 p-4 rounded-md overflow-x-auto"> <CopyableCode code={forceAptIpv4Code} />
<code>{forceAptIpv4Code}</code>
</pre>
</section> </section>
<section className="mb-8"> <section className="mb-8">
@ -149,13 +200,17 @@ ovs-vsctl --version
</p> </p>
<p className="mb-4"> <p className="mb-4">
<strong>Why it's beneficial:</strong> Open vSwitch provides advanced networking capabilities for virtualized <strong>Why it's beneficial:</strong> Open vSwitch provides advanced networking capabilities for virtualized
environments. It allows for more flexible and powerful network configurations, supporting features like VLAN environments. It allows for more flexible and powerful network configurations, including:
tagging, traffic shaping, and software-defined networking.
</p> </p>
<ul className="list-disc pl-5 mb-4">
<li>Support for VLAN tagging and trunking</li>
<li>Advanced traffic shaping and Quality of Service (QoS) capabilities</li>
<li>Integration with software-defined networking (SDN) controllers</li>
<li>Improved network performance and scalability for large virtualized environments</li>
<li>Support for network function virtualization (NFV)</li>
</ul>
<h4 className="text-lg font-semibold mb-2">To apply this optimization manually, you would run:</h4> <h4 className="text-lg font-semibold mb-2">To apply this optimization manually, you would run:</h4>
<pre className="bg-gray-100 p-4 rounded-md overflow-x-auto"> <CopyableCode code={installOpenVSwitchCode} />
<code>{installOpenVSwitchCode}</code>
</pre>
</section> </section>
<section className="mt-12 p-4 bg-blue-100 rounded-md"> <section className="mt-12 p-4 bg-blue-100 rounded-md">
@ -163,7 +218,8 @@ ovs-vsctl --version
<p> <p>
All of these optimizations are automatically applied when selected in the Network section of the All of these optimizations are automatically applied when selected in the Network section of the
customizable_post_install.sh script. This automation ensures that these beneficial settings are applied customizable_post_install.sh script. This automation ensures that these beneficial settings are applied
consistently and correctly. consistently and correctly, saving time and reducing the potential for human error during manual
configuration.
</p> </p>
</section> </section>
</div> </div>

View File

@ -204,6 +204,19 @@ EOF
sudo sysctl -p /etc/sysctl.d/99-memory.conf sudo sysctl -p /etc/sysctl.d/99-memory.conf
` `
const timeSyncCode = `
# Set timezone (replace 'America/New_York' with your timezone)
sudo timedatectl set-timezone America/New_York
# Enable automatic time synchronization
sudo timedatectl set-ntp true
# Note: Automatic timezone setting based on IP is commented out to avoid errors
# To set timezone automatically based on IP, you would need to run:
# IP=$(dig +short myip.opendns.com @resolver1.opendns.com)
# TIMEZONE=$(curl -s "https://ipapi.co/$IP/timezone")
# sudo timedatectl set-timezone "$TIMEZONE"
`
return ( return (
<div className="container mx-auto px-4 py-8"> <div className="container mx-auto px-4 py-8">
@ -230,10 +243,8 @@ sudo sysctl -p /etc/sysctl.d/99-memory.conf
needs to be minimized. By using kexec, the system can skip the time-consuming hardware initialization process needs to be minimized. By using kexec, the system can skip the time-consuming hardware initialization process
during a reboot, resulting in much faster restart times. during a reboot, resulting in much faster restart times.
</p> </p>
<h4 className="text-lg font-semibold mb-2">To apply this optimization manually, you would run:</h4> <h4 className="text-lg font-semibold mb-2">To apply this optimization manually, run these commands:</h4>
<pre className="bg-gray-100 p-4 rounded-md overflow-x-auto"> <CopyableCode code={fastRebootCode} />
<code>{fastRebootCode}</code>
</pre>
</section> </section>
<section className="mb-8"> <section className="mb-8">
@ -247,10 +258,8 @@ sudo sysctl -p /etc/sysctl.d/99-memory.conf
Instead of remaining in a crashed state, the system will attempt to recover by rebooting, potentially Instead of remaining in a crashed state, the system will attempt to recover by rebooting, potentially
resolving the issue without manual intervention. resolving the issue without manual intervention.
</p> </p>
<h4 className="text-lg font-semibold mb-2">To apply this optimization manually, you would run:</h4> <h4 className="text-lg font-semibold mb-2">To apply this optimization manually, run these commands:</h4>
<pre className="bg-gray-100 p-4 rounded-md overflow-x-auto"> <CopyableCode code={kernelPanicCode} />
<code>{kernelPanicCode}</code>
</pre>
</section> </section>
<section className="mb-8"> <section className="mb-8">
@ -264,10 +273,8 @@ sudo sysctl -p /etc/sysctl.d/99-memory.conf
virtual environments, generating true randomness can be challenging, leading to potential bottlenecks. Haveged virtual environments, generating true randomness can be challenging, leading to potential bottlenecks. Haveged
helps maintain a healthy entropy pool, ensuring smooth operation of cryptographic tasks. helps maintain a healthy entropy pool, ensuring smooth operation of cryptographic tasks.
</p> </p>
<h4 className="text-lg font-semibold mb-2">To apply this optimization manually, you would run:</h4> <h4 className="text-lg font-semibold mb-2">To apply this optimization manually, run these commands:</h4>
<pre className="bg-gray-100 p-4 rounded-md overflow-x-auto"> <CopyableCode code={entropyCode} />
<code>{entropyCode}</code>
</pre>
</section> </section>
<section className="mb-8"> <section className="mb-8">
@ -280,10 +287,8 @@ sudo sysctl -p /etc/sysctl.d/99-memory.conf
virtualization environments. Increasing these limits allows for better utilization of system resources, virtualization environments. Increasing these limits allows for better utilization of system resources,
accommodating more concurrent operations and larger workloads without hitting artificial bottlenecks. accommodating more concurrent operations and larger workloads without hitting artificial bottlenecks.
</p> </p>
<h4 className="text-lg font-semibold mb-2">To apply this optimization manually, you would run:</h4> <h4 className="text-lg font-semibold mb-2">To apply this optimization manually, run these commands:</h4>
<pre className="bg-gray-100 p-4 rounded-md overflow-x-auto"> <CopyableCode code={systemLimitsCode} />
<code>{systemLimitsCode}</code>
</pre>
</section> </section>
<section className="mb-8"> <section className="mb-8">
@ -294,10 +299,8 @@ sudo sysctl -p /etc/sysctl.d/99-memory.conf
required by certain software or drivers. Having them installed ensures that you can compile and use custom required by certain software or drivers. Having them installed ensures that you can compile and use custom
kernel modules if needed, enhancing system flexibility and compatibility. kernel modules if needed, enhancing system flexibility and compatibility.
</p> </p>
<h4 className="text-lg font-semibold mb-2">To apply this optimization manually, you would run:</h4> <h4 className="text-lg font-semibold mb-2">To apply this optimization manually, run these commands:</h4>
<pre className="bg-gray-100 p-4 rounded-md overflow-x-auto"> <CopyableCode code={kernelHeadersCode} />
<code>{kernelHeadersCode}</code>
</pre>
</section> </section>
<section className="mb-8"> <section className="mb-8">
@ -308,10 +311,8 @@ sudo sysctl -p /etc/sysctl.d/99-memory.conf
limiting log sizes and adjusting logging levels, you can prevent logs from consuming excessive disk space limiting log sizes and adjusting logging levels, you can prevent logs from consuming excessive disk space
while still maintaining useful system information for troubleshooting. while still maintaining useful system information for troubleshooting.
</p> </p>
<h4 className="text-lg font-semibold mb-2">To apply this optimization manually, you would run:</h4> <h4 className="text-lg font-semibold mb-2">To apply this optimization manually, run these commands:</h4>
<pre className="bg-gray-100 p-4 rounded-md overflow-x-auto"> <CopyableCode code={journaldCode} />
<code>{journaldCode}</code>
</pre>
</section> </section>
<section className="mb-8"> <section className="mb-8">
@ -322,10 +323,8 @@ sudo sysctl -p /etc/sysctl.d/99-memory.conf
system performance. By compressing old logs and limiting their size, you prevent log files from growing system performance. By compressing old logs and limiting their size, you prevent log files from growing
indefinitely and potentially filling up your disk. indefinitely and potentially filling up your disk.
</p> </p>
<h4 className="text-lg font-semibold mb-2">To apply this optimization manually, you would run:</h4> <h4 className="text-lg font-semibold mb-2">To apply this optimization manually, run these commands:</h4>
<pre className="bg-gray-100 p-4 rounded-md overflow-x-auto"> <CopyableCode code={logrotateCode} />
<code>{logrotateCode}</code>
</pre>
</section> </section>
<section className="mb-8"> <section className="mb-8">
@ -338,10 +337,8 @@ sudo sysctl -p /etc/sysctl.d/99-memory.conf
especially in virtualized environments. They help ensure that memory is used efficiently, reduce the especially in virtualized environments. They help ensure that memory is used efficiently, reduce the
likelihood of out-of-memory errors, and improve the performance of memory-intensive applications. likelihood of out-of-memory errors, and improve the performance of memory-intensive applications.
</p> </p>
<h4 className="text-lg font-semibold mb-2">To apply this optimization manually, you would run:</h4> <h4 className="text-lg font-semibold mb-2">To apply this optimization manually, run these commands:</h4>
<pre className="bg-gray-100 p-4 rounded-md overflow-x-auto"> <CopyableCode code={memorySettingsCode} />
<code>{memorySettingsCode}</code>
</pre>
</section> </section>
<section className="mt-12 p-4 bg-blue-100 rounded-md"> <section className="mt-12 p-4 bg-blue-100 rounded-md">

View File

@ -1,5 +1,6 @@
import type { Metadata } from "next" import type { Metadata } from "next"
import { Box } from "lucide-react" import { Box } from "lucide-react"
import { CopyableCode } from "@/components/CopyableCode"
export const metadata: Metadata = { export const metadata: Metadata = {
title: "ProxMenux Post-Install: Virtualization Settings", title: "ProxMenux Post-Install: Virtualization Settings",
@ -31,11 +32,17 @@ export const metadata: Metadata = {
export default function VirtualizationSettingsPage() { export default function VirtualizationSettingsPage() {
const enableVfioIommuCode = ` const enableVfioIommuCode = `
#!/bin/bash
# Enable IOMMU for Intel or AMD CPU # Enable IOMMU for Intel or AMD CPU
# For Intel: if grep -q GenuineIntel /proc/cpuinfo; then
sed -i '/GRUB_CMDLINE_LINUX_DEFAULT=/ s/"$/ intel_iommu=on iommu=pt"/' /etc/default/grub sed -i '/GRUB_CMDLINE_LINUX_DEFAULT=/ s/"$/ intel_iommu=on iommu=pt"/' /etc/default/grub
# For AMD: elif grep -q AuthenticAMD /proc/cpuinfo; then
# sed -i '/GRUB_CMDLINE_LINUX_DEFAULT=/ s/"$/ amd_iommu=on iommu=pt"/' /etc/default/grub sed -i '/GRUB_CMDLINE_LINUX_DEFAULT=/ s/"$/ amd_iommu=on iommu=pt"/' /etc/default/grub
else
echo "Unknown CPU type. IOMMU might not be properly enabled."
exit 1
fi
# Configure VFIO modules # Configure VFIO modules
echo "vfio" >> /etc/modules echo "vfio" >> /etc/modules
@ -44,37 +51,62 @@ echo "vfio_pci" >> /etc/modules
echo "vfio_virqfd" >> /etc/modules echo "vfio_virqfd" >> /etc/modules
# Blacklist conflicting drivers # Blacklist conflicting drivers
echo "blacklist nouveau" >> /etc/modprobe.d/blacklist.conf cat <<EOF >> /etc/modprobe.d/blacklist.conf
echo "blacklist nvidia" >> /etc/modprobe.d/blacklist.conf blacklist nouveau
blacklist nvidia
blacklist radeon
blacklist amdgpu
EOF
# Update GRUB and initramfs # Update GRUB and initramfs
update-grub update-grub
update-initramfs -u -k all update-initramfs -u -k all
echo "VFIO IOMMU support has been enabled. Please reboot your system for changes to take effect."
` `
const installGuestAgentCode = ` const installGuestAgentCode = `
#!/bin/bash
# Detect virtualization environment # Detect virtualization environment
VIRT_ENV=$(systemd-detect-virt) VIRT_ENV=$(systemd-detect-virt)
# Install appropriate guest agent # Install appropriate guest agent
case $VIRT_ENV in case $VIRT_ENV in
kvm) kvm)
apt-get update
apt-get install -y qemu-guest-agent apt-get install -y qemu-guest-agent
systemctl enable qemu-guest-agent
systemctl start qemu-guest-agent
echo "QEMU Guest Agent installed and started."
;; ;;
vmware) vmware)
apt-get update
apt-get install -y open-vm-tools apt-get install -y open-vm-tools
systemctl enable open-vm-tools
systemctl start open-vm-tools
echo "Open VM Tools installed and started."
;; ;;
oracle) oracle)
apt-get update
apt-get install -y virtualbox-guest-utils apt-get install -y virtualbox-guest-utils
systemctl enable vboxadd
systemctl start vboxadd
echo "VirtualBox Guest Additions installed and started."
;; ;;
*) *)
echo "No specific guest agent needed or virtualization not detected." echo "No specific guest agent needed or virtualization not detected."
;; ;;
esac esac
echo "Guest agent installation process completed."
` `
const configureKsmtunedCode = ` const configureKsmtunedCode = `
#!/bin/bash
# Install KSM control daemon # Install KSM control daemon
apt-get update
apt-get install -y ksm-control-daemon apt-get install -y ksm-control-daemon
# Configure KSM based on system RAM # Configure KSM based on system RAM
@ -82,22 +114,30 @@ RAM_GB=$(free -g | awk '/^Mem:/{print $2}')
if [ $RAM_GB -le 16 ]; then if [ $RAM_GB -le 16 ]; then
sed -i 's/KSM_THRES_COEF=.*/KSM_THRES_COEF=50/' /etc/ksmtuned.conf sed -i 's/KSM_THRES_COEF=.*/KSM_THRES_COEF=50/' /etc/ksmtuned.conf
sed -i 's/KSM_SLEEP_MSEC=.*/KSM_SLEEP_MSEC=80/' /etc/ksmtuned.conf sed -i 's/KSM_SLEEP_MSEC=.*/KSM_SLEEP_MSEC=80/' /etc/ksmtuned.conf
echo "RAM <= 16GB: Setting KSM to start at 50% full"
elif [ $RAM_GB -le 32 ]; then elif [ $RAM_GB -le 32 ]; then
sed -i 's/KSM_THRES_COEF=.*/KSM_THRES_COEF=40/' /etc/ksmtuned.conf sed -i 's/KSM_THRES_COEF=.*/KSM_THRES_COEF=40/' /etc/ksmtuned.conf
sed -i 's/KSM_SLEEP_MSEC=.*/KSM_SLEEP_MSEC=60/' /etc/ksmtuned.conf sed -i 's/KSM_SLEEP_MSEC=.*/KSM_SLEEP_MSEC=60/' /etc/ksmtuned.conf
echo "RAM <= 32GB: Setting KSM to start at 60% full"
elif [ $RAM_GB -le 64 ]; then elif [ $RAM_GB -le 64 ]; then
sed -i 's/KSM_THRES_COEF=.*/KSM_THRES_COEF=30/' /etc/ksmtuned.conf sed -i 's/KSM_THRES_COEF=.*/KSM_THRES_COEF=30/' /etc/ksmtuned.conf
sed -i 's/KSM_SLEEP_MSEC=.*/KSM_SLEEP_MSEC=40/' /etc/ksmtuned.conf sed -i 's/KSM_SLEEP_MSEC=.*/KSM_SLEEP_MSEC=40/' /etc/ksmtuned.conf
echo "RAM <= 64GB: Setting KSM to start at 70% full"
elif [ $RAM_GB -le 128 ]; then elif [ $RAM_GB -le 128 ]; then
sed -i 's/KSM_THRES_COEF=.*/KSM_THRES_COEF=20/' /etc/ksmtuned.conf sed -i 's/KSM_THRES_COEF=.*/KSM_THRES_COEF=20/' /etc/ksmtuned.conf
sed -i 's/KSM_SLEEP_MSEC=.*/KSM_SLEEP_MSEC=20/' /etc/ksmtuned.conf sed -i 's/KSM_SLEEP_MSEC=.*/KSM_SLEEP_MSEC=20/' /etc/ksmtuned.conf
echo "RAM <= 128GB: Setting KSM to start at 80% full"
else else
sed -i 's/KSM_THRES_COEF=.*/KSM_THRES_COEF=10/' /etc/ksmtuned.conf sed -i 's/KSM_THRES_COEF=.*/KSM_THRES_COEF=10/' /etc/ksmtuned.conf
sed -i 's/KSM_SLEEP_MSEC=.*/KSM_SLEEP_MSEC=10/' /etc/ksmtuned.conf sed -i 's/KSM_SLEEP_MSEC=.*/KSM_SLEEP_MSEC=10/' /etc/ksmtuned.conf
echo "RAM > 128GB: Setting KSM to start at 90% full"
fi fi
# Enable ksmtuned service # Enable ksmtuned service
systemctl enable ksmtuned systemctl enable ksmtuned
systemctl start ksmtuned
echo "KSM configuration completed and service started."
` `
return ( return (
@ -122,12 +162,17 @@ systemctl enable ksmtuned
<p className="mb-4"> <p className="mb-4">
<strong>Why it's beneficial:</strong> IOMMU and VFIO support enables near-native performance for PCI devices <strong>Why it's beneficial:</strong> IOMMU and VFIO support enables near-native performance for PCI devices
(like GPUs or network cards) in virtual machines, which is crucial for high-performance virtualization (like GPUs or network cards) in virtual machines, which is crucial for high-performance virtualization
scenarios. scenarios. This allows for:
</p> </p>
<h4 className="text-lg font-semibold mb-2">To apply this optimization manually, you would run:</h4> <ul className="list-disc pl-5 mb-4">
<pre className="bg-gray-100 p-4 rounded-md overflow-x-auto"> <li>Direct access to hardware from within VMs, improving performance</li>
<code>{enableVfioIommuCode}</code> <li>Better isolation between host and guest systems</li>
</pre> <li>Support for advanced features like GPU passthrough for gaming or compute workloads</li>
</ul>
<h4 className="text-lg font-semibold mb-2">
To apply this optimization manually, save the following script and run it with root privileges:
</h4>
<CopyableCode code={enableVfioIommuCode} />
</section> </section>
<section className="mb-8"> <section className="mb-8">
@ -138,13 +183,19 @@ systemctl enable ksmtuned
</p> </p>
<p className="mb-4"> <p className="mb-4">
<strong>Why it's beneficial:</strong> Guest agents improve communication between the host and guest systems, <strong>Why it's beneficial:</strong> Guest agents improve communication between the host and guest systems,
enabling features like graceful shutdown, file sharing, and better performance monitoring. This ensures enabling features like:
smoother operation and management of virtual machines.
</p> </p>
<h4 className="text-lg font-semibold mb-2">To apply this optimization manually, you would run:</h4> <ul className="list-disc pl-5 mb-4">
<pre className="bg-gray-100 p-4 rounded-md overflow-x-auto"> <li>Graceful shutdown of virtual machines</li>
<code>{installGuestAgentCode}</code> <li>File sharing between host and guest</li>
</pre> <li>Better performance monitoring and resource allocation</li>
<li>Improved time synchronization</li>
<li>Enhanced mouse pointer integration</li>
</ul>
<h4 className="text-lg font-semibold mb-2">
To apply this optimization manually, save the following script and run it with root privileges:
</h4>
<CopyableCode code={installGuestAgentCode} />
</section> </section>
<section className="mb-8"> <section className="mb-8">
@ -155,13 +206,18 @@ systemctl enable ksmtuned
</p> </p>
<p className="mb-4"> <p className="mb-4">
<strong>Why it's beneficial:</strong> KSM allows the kernel to share identical memory pages between multiple <strong>Why it's beneficial:</strong> KSM allows the kernel to share identical memory pages between multiple
virtual machines, reducing overall memory usage. This can lead to better resource utilization, especially in virtual machines, providing several advantages:
environments with many similar virtual machines.
</p> </p>
<h4 className="text-lg font-semibold mb-2">To apply this optimization manually, you would run:</h4> <ul className="list-disc pl-5 mb-4">
<pre className="bg-gray-100 p-4 rounded-md overflow-x-auto"> <li>Reduced overall memory usage, allowing for higher VM density</li>
<code>{configureKsmtunedCode}</code> <li>Improved performance in environments with many similar VMs</li>
</pre> <li>Dynamic adjustment of KSM aggressiveness based on system memory pressure</li>
<li>Potential for running more VMs on the same hardware</li>
</ul>
<h4 className="text-lg font-semibold mb-2">
To apply this optimization manually, save the following script and run it with root privileges:
</h4>
<CopyableCode code={configureKsmtunedCode} />
</section> </section>
<section className="mt-12 p-4 bg-blue-100 rounded-md"> <section className="mt-12 p-4 bg-blue-100 rounded-md">
@ -169,7 +225,8 @@ systemctl enable ksmtuned
<p> <p>
All of these optimizations are automatically applied when selected in the Virtualization section of the All of these optimizations are automatically applied when selected in the Virtualization section of the
customizable_post_install.sh script. This automation ensures that these beneficial settings are applied customizable_post_install.sh script. This automation ensures that these beneficial settings are applied
consistently and correctly. consistently and correctly, saving time and reducing the potential for human error during manual
configuration.
</p> </p>
</section> </section>
</div> </div>