Install KVM on Linux
sa3i0l
Posted on May 2, 2023
Install KVM packages
Installing all packages needed to run KVM:
sudo pacman -Syy
sudo pacman -S archlinux-keyring
sudo pacman -S qemu virt-manager virt-viewer dnsmasq vde2 bridge-utils openbsd-netcat
Also install ebtables and iptables packages:
sudo pacman -S ebtables iptables
Step 2: Install libguestfs
sudo pacman -S libguestfs
Step 3: Start KVM libvirt service
sudo systemctl enable libvirtd.service
sudo systemctl start libvirtd.service
//runing ?
systemctl status libvirtd.service
Step 4: Enable normal user account to use KVM
sudo vim /etc/libvirt/libvirtd.conf
Set the UNIX domain socket group ownership to libvirt, (around line 85)
unix_sock_group = "libvirt"
Set the UNIX socket permissions for the R/W socket (around line 102)
unix_sock_rw_perms = "0770"
Add your user account to libvirt group.
sudo usermod -a -G libvirt $(whoami)
newgrp libvirt
Restart libvirt daemon.
sudo systemctl restart libvirtd.service
Step 5: Enable Nested Virtualization (Optional)
Nested Virtualization feature enables you to run Virtual Machines inside a VM. Enable Nested virtualization for kvm_intel / kvm_amd
by enabling kernel module as shown.
### Intel Processor ###
sudo modprobe -r kvm_intel
sudo modprobe kvm_intel nested=1
### AMD Processor ###
sudo modprobe -r kvm_amd
sudo modprobe kvm_amd nested=1
To make this configuration persistent,run:
echo "options kvm-intel nested=1" | sudo tee /etc/modprobe.d/kvm-intel.conf
Confirm that Nested Virtualization is set to Yes:
### Intel Processor ###
$ systool -m kvm_intel -v | grep nested
nested = "Y"
nested_early_check = "N"
$ cat /sys/module/kvm_intel/parameters/nested
Y
### AMD Processor ###
$ systool -m kvm_amd -v | grep nested
nested = "Y"
nested_early_check = "N"
$ cat /sys/module/kvm_amd/parameters/nested
Y
Step 6:
Run "Virtual Machine Manager"
💖 💪 🙅 🚩
sa3i0l
Posted on May 2, 2023
Join Our Newsletter. No Spam, Only the good stuff.
Sign up to receive the latest update from our blog.
Related
webdev Understanding HTTP, Cookies, Email Protocols, and DNS: A Guide to Key Internet Technologies
November 30, 2024