Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # ===========================================
- # KVM Virtualization Setup on Fedora
- # ===========================================
- ##################################################################
- Join our telegram channel for more : https://t.me/LinuxClassesEFXTv
- ##################################################################
- # Step 1: Check if virtualization is supported and enabled on the system
- egrep '^flags.*(vmx|svm)' /proc/cpuinfo # Look for virtualization CPU flags (vmx for Intel, svm for AMD)
- lsmod | grep kvm # Check if KVM modules are loaded
- modinfo kvm | head # View KVM module information
- lscpu | grep -i virtualization # Confirm virtualization support via lscpu
- # Step 2: Check if KVM is built into the kernel
- zgrep CONFIG_KVM /boot/config-$(uname -r)
- # Step 3: Install the virtualization group and core packages
- sudo dnf install -y @virtualization
- # Step 4: Enable and start necessary services
- sudo systemctl enable --now libvirtd
- # Step 5: Install additional virtualization tools and dependencies
- sudo dnf install -y qemu-kvm libvirt virt-install virt-manager virt-viewer edk2-ovmf swtpm qemu-img guestfs-tools libosinfo tuned
- # Step 6: Add VirtIO driver repository for Windows VMs
- sudo wget https://fedorapeople.org/groups/virt/virtio-win/virtio-win.repo -O /etc/yum.repos.d/virtio-win.repo
- # Step 7: Enable the repository (edit line 14 and set enabled=1)
- sudo sed -i 's/enabled=0/enabled=1/' /etc/yum.repos.d/virtio-win.repo
- # Step 8: Install the VirtIO ISO package
- sudo dnf install -y virtio-win
- # Optional: Download latest VirtIO ISO manually from:
- # https://fedorapeople.org/groups/virt/virtio-win/direct-downloads/archive-virtio/
- # Step 9: Check the service file for virtqemud
- sudo dnf provides */virtqemud.service
- # Step 10: Enable Modular libvirt daemons
- for drv in qemu interface network nodedev nwfilter secret storage; do
- sudo systemctl enable virt${drv}d.service
- sudo systemctl enable virt${drv}d{,-ro,-admin}.socket
- done
- # Step 11: Validate your host’s virtualization setup
- sudo virt-host-validate qemu
- # Step 12: Enable VT-d (for Intel IOMMU support)
- # Edit GRUB config
- sudo vim /etc/default/grub
- # Add to GRUB_CMDLINE_LINUX:
- # GRUB_CMDLINE_LINUX="rhgb quiet intel_iommu=on iommu=pt"
- # Update GRUB configuration
- sudo grub2-mkconfig -o /boot/grub2/grub.cfg
- # Reboot system to apply changes
- sudo reboot
- # Step 13: Re-validate the virtualization setup after reboot
- sudo virt-host-validate qemu
- # Step 14: Optimize the host system using TuneD
- sudo systemctl enable --now tuned
- # Check current profile
- tuned-adm active
- # List available tuned profiles
- tuned-adm list
- # Set the profile optimized for virtualization
- sudo tuned-adm profile virtual-host
- # Confirm the profile change
- tuned-adm active
- # Step 15: Configure a network bridge (optional, for bridging VM network interfaces)
- # List existing networks
- sudo virsh net-list --all
- # Create a bridge interface (name it as needed, e.g., bridge0)
- sudo nmcli connection add type bridge con-name bridge0 ifname bridge0
- # (Continue bridge setup as needed based on your specific networking requirements)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement