KVM on Ubuntu

Requirement checks

  1. To check the machine’s CPU supports hardware virtualisation:

egrep -c '(vmx|svm)' /proc/cpuinfo

If returns 0, the processor does not support it. Any other number is ok. Note: lm stands for Long Mode which equates to a 64-bit CPU.

  1. To check virtualisation is enabled in the BIOS, install cpu-checker and check if the system can use kvm acceleration:

sudo apt install cpu-checker
sudo kvm-ok

The response must include INFO: /dev/kvm exists.

If you see :

INFO: Your CPU does not support KVM extensions
KVM acceleration can NOT be used

You can still run virtual machines, but it will be incredibly slow.

Install essential packages

sudo apt install qemu-kvm libvirt-daemon-system libvirt-clients bridge-utils

Add users to groups

sudo adduser '[username]' libvirt
sudo adduser '[username]' kvm

Relogin so that username becomes an effective member of the libvirtd and kvm groups. The members of this group can run virtual machines.

Verify installation

virsh list --all
sudo systemctl status libvirtd

If not active, enable with:

sudo systemctl enable --now libvirtd

Install virt manager GUI

sudo apt install virt-manager

Launch it to create Virtual Machines.