Install KVM on Ubuntu 22.04
KVM (Kernel-based Virtual Machine) is a Linux hypervisor built into the kernel. This guide covers installing and verifying KVM on Ubuntu 22.04.
Step 1 — Verify CPU Virtualisation Support
egrep -c '(vmx|svm)' /proc/cpuinfo
# Result > 0 means virtualisation is supported
sudo kvm-ok
# Should output: KVM acceleration can be used
Step 2 — Install KVM and Management Tools
sudo apt-get update
sudo apt-get install -y qemu-kvm libvirt-daemon-system libvirt-clients \
bridge-utils virtinst virt-manager
Step 3 — Add Your User to the Groups
sudo usermod -aG kvm $USER
sudo usermod -aG libvirt $USER
# Log out and back in for this to take effect
Step 4 — Enable and Start libvirtd
sudo systemctl enable libvirtd
sudo systemctl start libvirtd
sudo systemctl status libvirtd
Step 5 — Verify Installation
virsh list --all
# Should show an empty VM list (no VMs yet)
virt-host-validate
# Should show all PASS
Create a VM (CLI)
sudo virt-install \
--name ubuntu22 \
--ram 2048 \
--vcpus 2 \
--disk path=/var/lib/libvirt/images/ubuntu22.qcow2,size=20 \
--os-variant ubuntu22.04 \
--network bridge=virbr0 \
--cdrom /path/to/ubuntu-22.04.iso \
--graphics vnc