2025-02-25 20:40:47 +01:00
|
|
|
import type { Metadata } from "next"
|
2025-03-01 16:12:26 +01:00
|
|
|
import { Box } from "lucide-react"
|
2025-03-01 19:08:07 +01:00
|
|
|
import CopyableCode from "@/components/CopyableCode"
|
2025-02-25 20:40:47 +01:00
|
|
|
|
|
|
|
export const metadata: Metadata = {
|
|
|
|
title: "ProxMenux Post-Install: Virtualization Settings",
|
|
|
|
description:
|
2025-03-01 18:07:08 +01:00
|
|
|
"Detailed guide to the Virtualization Settings category in the ProxMenux post-install script for Proxmox VE optimization.",
|
|
|
|
openGraph: {
|
|
|
|
title: "ProxMenux Post-Install: Virtualization Settings",
|
|
|
|
description:
|
|
|
|
"Detailed guide to the Virtualization Settings category in the ProxMenux post-install script for Proxmox VE optimization.",
|
|
|
|
type: "article",
|
|
|
|
url: "https://macrimi.github.io/ProxMenux/docs/post-install/virtualization",
|
|
|
|
images: [
|
|
|
|
{
|
|
|
|
url: "https://macrimi.github.io/ProxMenux/virtualization-settings-image.png",
|
|
|
|
width: 1200,
|
|
|
|
height: 630,
|
|
|
|
alt: "ProxMenux Post-Install Virtualization Settings",
|
|
|
|
},
|
|
|
|
],
|
|
|
|
},
|
|
|
|
twitter: {
|
|
|
|
card: "summary_large_image",
|
|
|
|
title: "ProxMenux Post-Install: Virtualization Settings",
|
|
|
|
description:
|
|
|
|
"Detailed guide to the Virtualization Settings category in the ProxMenux post-install script for Proxmox VE optimization.",
|
|
|
|
images: ["https://macrimi.github.io/ProxMenux/virtualization-settings-image.png"],
|
|
|
|
},
|
2025-02-25 20:40:47 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
export default function VirtualizationSettingsPage() {
|
2025-03-01 18:07:08 +01:00
|
|
|
const enableVfioIommuCode = `
|
2025-03-01 18:46:22 +01:00
|
|
|
#!/bin/bash
|
|
|
|
|
2025-03-01 18:07:08 +01:00
|
|
|
# Enable IOMMU for Intel or AMD CPU
|
2025-03-01 18:46:22 +01:00
|
|
|
if grep -q GenuineIntel /proc/cpuinfo; then
|
|
|
|
sed -i '/GRUB_CMDLINE_LINUX_DEFAULT=/ s/"$/ intel_iommu=on iommu=pt"/' /etc/default/grub
|
|
|
|
elif grep -q AuthenticAMD /proc/cpuinfo; then
|
|
|
|
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
|
2025-03-01 18:07:08 +01:00
|
|
|
|
|
|
|
# Configure VFIO modules
|
|
|
|
echo "vfio" >> /etc/modules
|
|
|
|
echo "vfio_iommu_type1" >> /etc/modules
|
|
|
|
echo "vfio_pci" >> /etc/modules
|
|
|
|
echo "vfio_virqfd" >> /etc/modules
|
|
|
|
|
|
|
|
# Blacklist conflicting drivers
|
2025-03-01 18:46:22 +01:00
|
|
|
cat <<EOF >> /etc/modprobe.d/blacklist.conf
|
|
|
|
blacklist nouveau
|
|
|
|
blacklist nvidia
|
|
|
|
blacklist radeon
|
|
|
|
blacklist amdgpu
|
|
|
|
EOF
|
2025-03-01 18:07:08 +01:00
|
|
|
|
|
|
|
# Update GRUB and initramfs
|
|
|
|
update-grub
|
|
|
|
update-initramfs -u -k all
|
2025-03-01 18:46:22 +01:00
|
|
|
|
|
|
|
echo "VFIO IOMMU support has been enabled. Please reboot your system for changes to take effect."
|
2025-03-01 18:07:08 +01:00
|
|
|
`
|
|
|
|
|
|
|
|
const installGuestAgentCode = `
|
2025-03-01 18:46:22 +01:00
|
|
|
#!/bin/bash
|
|
|
|
|
2025-03-01 18:07:08 +01:00
|
|
|
# Detect virtualization environment
|
|
|
|
VIRT_ENV=$(systemd-detect-virt)
|
|
|
|
|
|
|
|
# Install appropriate guest agent
|
|
|
|
case $VIRT_ENV in
|
|
|
|
kvm)
|
2025-03-01 18:46:22 +01:00
|
|
|
apt-get update
|
2025-03-01 18:07:08 +01:00
|
|
|
apt-get install -y qemu-guest-agent
|
2025-03-01 18:46:22 +01:00
|
|
|
systemctl enable qemu-guest-agent
|
|
|
|
systemctl start qemu-guest-agent
|
|
|
|
echo "QEMU Guest Agent installed and started."
|
2025-03-01 18:07:08 +01:00
|
|
|
;;
|
|
|
|
vmware)
|
2025-03-01 18:46:22 +01:00
|
|
|
apt-get update
|
2025-03-01 18:07:08 +01:00
|
|
|
apt-get install -y open-vm-tools
|
2025-03-01 18:46:22 +01:00
|
|
|
systemctl enable open-vm-tools
|
|
|
|
systemctl start open-vm-tools
|
|
|
|
echo "Open VM Tools installed and started."
|
2025-03-01 18:07:08 +01:00
|
|
|
;;
|
|
|
|
oracle)
|
2025-03-01 18:46:22 +01:00
|
|
|
apt-get update
|
2025-03-01 18:07:08 +01:00
|
|
|
apt-get install -y virtualbox-guest-utils
|
2025-03-01 18:46:22 +01:00
|
|
|
systemctl enable vboxadd
|
|
|
|
systemctl start vboxadd
|
|
|
|
echo "VirtualBox Guest Additions installed and started."
|
2025-03-01 18:07:08 +01:00
|
|
|
;;
|
|
|
|
*)
|
|
|
|
echo "No specific guest agent needed or virtualization not detected."
|
|
|
|
;;
|
|
|
|
esac
|
2025-03-01 18:46:22 +01:00
|
|
|
|
|
|
|
echo "Guest agent installation process completed."
|
2025-03-01 18:07:08 +01:00
|
|
|
`
|
|
|
|
|
|
|
|
const configureKsmtunedCode = `
|
2025-03-01 18:46:22 +01:00
|
|
|
#!/bin/bash
|
|
|
|
|
2025-03-01 18:07:08 +01:00
|
|
|
# Install KSM control daemon
|
2025-03-01 18:46:22 +01:00
|
|
|
apt-get update
|
2025-03-01 18:07:08 +01:00
|
|
|
apt-get install -y ksm-control-daemon
|
|
|
|
|
|
|
|
# Configure KSM based on system RAM
|
|
|
|
RAM_GB=$(free -g | awk '/^Mem:/{print $2}')
|
|
|
|
if [ $RAM_GB -le 16 ]; then
|
|
|
|
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
|
2025-03-01 18:46:22 +01:00
|
|
|
echo "RAM <= 16GB: Setting KSM to start at 50% full"
|
2025-03-01 18:07:08 +01:00
|
|
|
elif [ $RAM_GB -le 32 ]; then
|
|
|
|
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
|
2025-03-01 18:46:22 +01:00
|
|
|
echo "RAM <= 32GB: Setting KSM to start at 60% full"
|
2025-03-01 18:07:08 +01:00
|
|
|
elif [ $RAM_GB -le 64 ]; then
|
|
|
|
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
|
2025-03-01 18:46:22 +01:00
|
|
|
echo "RAM <= 64GB: Setting KSM to start at 70% full"
|
2025-03-01 18:07:08 +01:00
|
|
|
elif [ $RAM_GB -le 128 ]; then
|
|
|
|
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
|
2025-03-01 18:46:22 +01:00
|
|
|
echo "RAM <= 128GB: Setting KSM to start at 80% full"
|
2025-03-01 18:07:08 +01:00
|
|
|
else
|
|
|
|
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
|
2025-03-01 18:46:22 +01:00
|
|
|
echo "RAM > 128GB: Setting KSM to start at 90% full"
|
2025-03-01 18:07:08 +01:00
|
|
|
fi
|
|
|
|
|
|
|
|
# Enable ksmtuned service
|
|
|
|
systemctl enable ksmtuned
|
2025-03-01 18:46:22 +01:00
|
|
|
systemctl start ksmtuned
|
|
|
|
|
|
|
|
echo "KSM configuration completed and service started."
|
2025-03-01 18:07:08 +01:00
|
|
|
`
|
|
|
|
|
2025-02-25 20:40:47 +01:00
|
|
|
return (
|
|
|
|
<div className="container mx-auto px-4 py-8">
|
2025-03-01 16:12:26 +01:00
|
|
|
<div className="flex items-center mb-6">
|
|
|
|
<Box className="h-8 w-8 mr-2 text-blue-500" />
|
|
|
|
<h1 className="text-3xl font-bold">Virtualization Settings</h1>
|
2025-03-01 16:17:08 +01:00
|
|
|
</div>
|
2025-03-01 18:07:08 +01:00
|
|
|
<p className="mb-4">
|
|
|
|
The Virtualization Settings category in the customizable_post_install.sh script focuses on optimizing your
|
|
|
|
Proxmox VE installation for better virtualization performance and compatibility.
|
|
|
|
</p>
|
|
|
|
|
|
|
|
<h2 className="text-2xl font-semibold mt-8 mb-4">Available Optimizations</h2>
|
|
|
|
|
|
|
|
<section className="mb-8">
|
|
|
|
<h3 className="text-xl font-semibold mb-2">1. Enable VFIO IOMMU Support</h3>
|
|
|
|
<p className="mb-4">
|
|
|
|
This optimization enables IOMMU (Input-Output Memory Management Unit) and configures VFIO (Virtual Function
|
|
|
|
I/O) for PCI passthrough, allowing direct assignment of PCI devices to virtual machines.
|
|
|
|
</p>
|
|
|
|
<p className="mb-4">
|
|
|
|
<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
|
2025-03-01 18:46:22 +01:00
|
|
|
scenarios. This allows for:
|
2025-03-01 18:07:08 +01:00
|
|
|
</p>
|
2025-03-01 18:46:22 +01:00
|
|
|
<ul className="list-disc pl-5 mb-4">
|
|
|
|
<li>Direct access to hardware from within VMs, improving performance</li>
|
|
|
|
<li>Better isolation between host and guest systems</li>
|
|
|
|
<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} />
|
2025-03-01 18:07:08 +01:00
|
|
|
</section>
|
|
|
|
|
|
|
|
<section className="mb-8">
|
|
|
|
<h3 className="text-xl font-semibold mb-2">2. Install Relevant Guest Agent</h3>
|
|
|
|
<p className="mb-4">
|
|
|
|
This optimization detects the virtualization environment and installs the appropriate guest agent for improved
|
|
|
|
integration between the host and guest systems.
|
|
|
|
</p>
|
|
|
|
<p className="mb-4">
|
|
|
|
<strong>Why it's beneficial:</strong> Guest agents improve communication between the host and guest systems,
|
2025-03-01 18:46:22 +01:00
|
|
|
enabling features like:
|
2025-03-01 18:07:08 +01:00
|
|
|
</p>
|
2025-03-01 18:46:22 +01:00
|
|
|
<ul className="list-disc pl-5 mb-4">
|
|
|
|
<li>Graceful shutdown of virtual machines</li>
|
|
|
|
<li>File sharing between host and guest</li>
|
|
|
|
<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} />
|
2025-03-01 18:07:08 +01:00
|
|
|
</section>
|
|
|
|
|
|
|
|
<section className="mb-8">
|
|
|
|
<h3 className="text-xl font-semibold mb-2">3. Configure KSM Control Daemon</h3>
|
|
|
|
<p className="mb-4">
|
|
|
|
This optimization installs and configures the KSM (Kernel Samepage Merging) control daemon, which helps
|
|
|
|
optimize memory usage in virtualized environments.
|
|
|
|
</p>
|
|
|
|
<p className="mb-4">
|
|
|
|
<strong>Why it's beneficial:</strong> KSM allows the kernel to share identical memory pages between multiple
|
2025-03-01 18:46:22 +01:00
|
|
|
virtual machines, providing several advantages:
|
2025-03-01 18:07:08 +01:00
|
|
|
</p>
|
2025-03-01 18:46:22 +01:00
|
|
|
<ul className="list-disc pl-5 mb-4">
|
|
|
|
<li>Reduced overall memory usage, allowing for higher VM density</li>
|
|
|
|
<li>Improved performance in environments with many similar VMs</li>
|
|
|
|
<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} />
|
2025-03-01 18:07:08 +01:00
|
|
|
</section>
|
|
|
|
|
|
|
|
<section className="mt-12 p-4 bg-blue-100 rounded-md">
|
|
|
|
<h2 className="text-xl font-semibold mb-2">Automatic Application</h2>
|
|
|
|
<p>
|
|
|
|
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
|
2025-03-01 18:46:22 +01:00
|
|
|
consistently and correctly, saving time and reducing the potential for human error during manual
|
|
|
|
configuration.
|
2025-03-01 18:07:08 +01:00
|
|
|
</p>
|
|
|
|
</section>
|
2025-02-25 20:40:47 +01:00
|
|
|
</div>
|
|
|
|
)
|
|
|
|
}
|
|
|
|
|