Installing virtualization tools - Qrivi/KVM GitHub Wiki
This will be the easiest part.
We will be installing QEMU which we'll use for hardware virtualization, libvirt
to manage our virtualization and VMs, OVMF for a powerful virtual UEFI, Virtual Machine Manager to get a nice GUI and some firewall packages required by libvirt
.
sudo pacman -Sy qemu libvirt ovmf virt-manager ebtables iptables dnsmasq
Enable, start, and we're good to go!
sudo systemctl enable libvirtd.service virtlogd.socket
sudo systemctl start libvirtd.service virtlogd.socket
sudo virsh net-start default
sudo virsh net-autostart default
While this is an extra, optional step, I recommend to add a libvirt
hook that prevents the host from automatically going into sleep mode if a VM is running, as VFIO-enabled machines tend to become unstable if left running through a sleep/wakeup cycle on the host. We'll copy a sleep-preventing service and the hook from the scripts folder. This is not required if e.g. you set up the host to never auto-sleep at all.
sudo cp ~/KVM/scripts/[email protected] /etc/systemd/system
sudo mkdir /etc/libvirt/hooks
sudo cp ~/KVM/scripts/qemu /etc/libvirt/hooks
chmod +x /etc/libvirt/hooks/qemu
We have to update the sudoers file so the hook can be run without prompting for the root password.
sudo EDITOR=nano visudo
Append the following to the sudoers file:
%libvirt ALL=NOPASSWD: /bin/systemctl