#!/linuxSucks/Install Qemu Kvm
May 13, 2023Install all necessary packages
sudo pacman -S virt-manager virt-viewer qemu edk2-ovmf vde2 ebtables dnsmasq bridge-utils openbsd-netcat libguestfs dmidecode
Enable libvirt daemon
systemctl enable libvirtd.service
systemctl start libvirtd.service
Create bridge interface
sudo nvim br10.xml
Inside the new file copy and paste, you can change the ip address to your like
<network>
<name>br10</name>
<forward mode='nat'>
<nat>
<port start='1024' end='65535'/>
</nat>
</forward>
<bridge name='br10' stp='on' delay='0'/>
<ip address='192.168.30.1' netmask='255.255.255.0'>
<dhcp>
<range start='192.168.30.50' end='192.168.30.200'/>
</dhcp>
</ip>
</network>
Define and autostart network bridge
sudo virsh net-define br10.xml
sudo virsh net-start br10
sudo virsh net-autostart br10
Enable normal user account to use KVM
Open libvirtd.conf file
sudo nvim /etc/libvirt/libvirtd.conf
Then change and un-comment this lines
unix_sock_group = "libvirt"
unix_sock_ro_perms = "0777"
unix_sock_rw_perms = "0770"
Add current user to kvm and libvirt groups
sudo usermod -a -G kvm $(whoami)
sudo usermod -a -G libvirt $(whoami)
newgrp libvirt
Enable nested virtulization (optional)
sudo modprobe -r kvm_intel
sudo modprobe kvm_intel nested=1
echo "options kvm-intel nested=1" | sudo tee /etc/modprobe.d/kvm-intel.conf
verify nested virtualization
systool -m kvm_intel -v | grep nested
cat /sys/module/kvm_intel/parameters/nested
If everything is ok you need to logout or reboot you computer