Back to blog
GuidesSeptember 19, 2026·3 min read

How to Install KVM on Ubuntu

How to Install KVM on Ubuntu

How to Install KVM on Ubuntu

The command sudo apt install qemu-kvm libvirt-daemon-system will do the trick for you. The following guide will show how to install KVM in addition to testing the presence of a KVM-supportive CPU and the group membership necessary for virsh to work without sudo.

How do I check if my CPU supports KVM virtualization?

To test it, use the command kvm-ok which is part of cpu-checker:

$ sudo apt install cpu-checker
$ kvm-ok

According to official documentation by Ubuntu, it should say "KVM acceleration can be used" if a CPU supports KVM virtualization.

How do I install KVM and libvirt on Ubuntu?

Use sudo apt install qemu-kvm libvirt-daemon-system. Package qemu-kvm provides virtualization engine and package libvirt-daemon-system – a management daemon for the tooling like virsh.

$ sudo apt update
$ sudo apt install qemu-kvm libvirt-daemon-system

That's the very package pair specified in Ubuntu's official libvirt documentation.

Installing qemu-kvm alone would provide you with an engine, but not a daemon required for virsh and other tools to interact with it.

Why do I need to add my user to the libvirt group?

Otherwise, you would have to use sudo before any virsh command to access the libvirt daemon.

$ sudo adduser $USER libvirt

Apart from making commands more convenient, according to Ubuntu's official documentation, this also "grants the user access to advanced networking options."

Am I already in the libvirt group if I'm in the sudo group?

Yes, I am. Members of the sudo group are automatically added to libvirt; members of other groups should be added to it manually with adduser.

$ groups

Members of the sudo group are added automatically, but you must manually add other users who need access to system-wide libvirt resources, as official documentation says. Running groups in terminal is the quickest way to check whether you belong to either group.

Why do I need to log out and back in after adding myself to the group?

Because group membership is read at login time; it's not done continuously. Thus, in order to use a new group in your terminal session, you need to start a new session.

$ sudo adduser $USER libvirt
$ exit

The same reason is given in documentation which tells us to log out and log in after running adduser.

Our VPS plans and Bare Metal servers provide you with full apt access and group configuration, and thus allow KVM installation as shown in this guide.

Get started with Orbit Servers

Low-latency VPS, bare metal, and colocation across the US, EU, and APAC - provisioned instantly and built for performance-critical workloads.

Get started
J

Written by

Julius

Related posts