Virtualization - Sawangg/dotfiles GitHub Wiki

To emulate any OS on our machine, we're going to use the QEMU emulator with the KVM hypervisor.

KVM

Follow this article to see if your hardware supports KVM and if it's currently running on your machine.

QEMU

Install all the necessaries dependencies and start the services.

sudo pacman -S qemu-desktop libvirt libvirt-dinit dnsmasq dnsmasq-dinit virt-manager
sudo dinitctl enable dnsmasq
sudo dinitctl enable libvirtd
sudo usermod -aG libvirt,dnsmasq $(whoami)

Network

You need to setup the network so your VMs will be able to access the internet. First start the default network by running

sudo virsh net-start default

Next we're going to use the helper called qemu-bridge-helper. Check that you have ip forwarding enabled in /etc/sysctl.d/99-network.conf and run

sudo echo "allow virbr0" > /etc/qemu/bridge.conf
sudo chown root:kvm /etc/qemu/bridge.conf
sudo chmod 0660 /etc/qemu/bridge.conf
sudo chmod u+s /usr/lib/qemu/qemu-bridge-helper

Now you can create a VM and assign a bridge network with vibr0 as the interface.