DEV Community

Rost
Rost

Posted on

Install KVM on Ubuntu 24.04

You install KVM on Ubuntu 24.04 by checking CPU virtualization support, installing the KVM/libvirt packages, enabling the libvirtd service, and (optionally) installing virt‑manager for a GUI.

1. Check virtualization support

Run these commands in a terminal:

  • Check CPU flags: lscpu | grep -E 'vmx|svm' If you see vmx (Intel) or svm (AMD), your CPU supports virtualization.
  • (Optional) Install cpu-checker and run kvm-ok:
sudo apt update
sudo apt install -y cpu-checker
kvm-ok
Enter fullscreen mode Exit fullscreen mode

You should see “/dev/kvm exists” and “KVM acceleration can be used”.

If no virtualization support is reported, enable it in your BIOS/UEFI, then boot back into Ubuntu.

2. Install KVM and core packages

Install KVM, QEMU, libvirt, and networking tools:

sudo apt update
sudo apt install -y qemu-kvm libvirt-daemon-system libvirt-clients bridge-utils virtinst
Enter fullscreen mode Exit fullscreen mode

This provides the KVM hypervisor, QEMU, libvirt daemon, and utilities needed to create and manage virtual machines.

3. Enable and start libvirtd

Ensure the libvirt daemon starts automatically and is running:

sudo systemctl enable --now libvirtd
sudo systemctl status libvirtd
Enter fullscreen mode Exit fullscreen mode

The status command should show the service as “active (running)” with no errors.

4. Add your user to groups

Add your user to the kvm and libvirt groups so you do not need sudo for every VM action:

sudo adduser $USER kvm
sudo adduser $USER libvirt
Enter fullscreen mode Exit fullscreen mode

Log out and log back in (or reboot) so the new group memberships take effect.

5. (Optional) Install virt‑manager GUI

If you want a graphical interface to manage VMs:

sudo apt install -y virt-manager
Enter fullscreen mode Exit fullscreen mode

Then:

  • Start from the app menu (“Virtual Machine Manager”) or run virt-manager.
  • Click “Create a new virtual machine”, choose your ISO, set RAM/CPU/disk, and finish the wizard to create a VM.

7. (Optional) Install Gnome Boxes GUI

sudo apt-get install gnome-boxes

gnome-boxes
Enter fullscreen mode Exit fullscreen mode

And similar - press + on the top left and create new VM from file or download installation of your favorite guest OS.

Usefull Links

Top comments (0)