How to install KVM on Ubuntu 20.04

KVM (Kernel Based Virtual Machine) is an open source virtualization technology built into the Linux kernel. With KVM to run multiple Linux or Windows guest virtual machines. Each guest is completely isolated from the others and has their own operating system and dedicated virtual hardware such as CPU, memory, network interfaces, and storage.

This article provides instructions for installing and configuring KVM on your Ubuntu 20.04 desktop. We’ll also show you how to create virtual machines that can be used as a development environment for various applications.


To run guests with more than 2 GB of RAM, you must have a 64-bit host system.

Make sure your Ubuntu host machine supports KVM virtualization before proceeding with the installation. The system must have either an Intel processor with VT-x (vmx) or an AMD processor with AMD-V technology (svm).

Run grep to make sure your processor supports hardware virtualization:

grep -Eoc '(vmx|svm)' /proc/cpuinfo

If the CPU supports hardware virtualization, the command will print a number greater than zero, which is the number of CPU cores. Otherwise, if the output is 0, then the CPU does not support hardware virtualization.

On some machines, virtual technological extensions may be disabled in the BIOS by manufacturers.

To check if VT is enabled in BIOS, use the kvm-ok tool that is included in the package. Enter the following commands as root or as a user with sudo privileges to install the cpu-checker package, which includes the kvm-ok command:

sudo apt updatesudo apt install cpu-checker

After installation, check if your system can run hardware accelerated KVM virtual machines:


If processor virtualization is not disabled in BIOS, the output will look something like this:

INFO: /dev/kvm exists
KVM acceleration can be used

Otherwise, the command will print both an error message and possibly a short message on how to enable the extension. The process for enabling AMD-V or VT technology depends on your motherboard and processor type. Refer to your motherboard documentation for information on how to configure your system BIOS.

Installing KVM on Ubuntu 20.04

Run the following command to install KVM and additional virtualization management packs:

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

  • qemu-kvm is software that provides hardware emulation for the KVM hypervisor.
  • libvirt-daemon-system – configuration files for starting the libvirt daemon as a system service.
  • libvirt-clients is software for managing virtualization platforms.
  • bridge-utils is a command line toolkit for configuring Ethernet bridges.
  • virtinst is a set of command line tools for creating virtual machines.
  • virt-manager is an easy-to-use graphical interface and command line helper utilities for managing virtual machines via libvirt.

After installing the packages, the libvirt daemon will start automatically. You can check this by typing:

sudo systemctl is-active libvirtd

To be able to create and manage virtual machines, you need to add your user to the “libvirt” and “kvm” groups. To do this, enter:

sudo usermod -aG libvirt $USERsudo usermod -aG kvm $USER

The $ USER environment variable that contains the name of the currently logged in user.

Log out and back in to renew your group membership.

Network configuration

A bridge named virbr0 is created during installation. This device uses NAT to connect guest computers to the outside world.

You can use the brctl tool to display the current bridges and the interfaces they are connected to:

brctl show
bridge name	bridge id		      STP enabled	interfaces
virbr0		  8000.52540089db3f	yes		      virbr0-nic

The virbr0 bridge has no added physical interfaces. Virbr0-nic is a virtual device with no traffic passing through it. The sole purpose of this device is to avoid changing the MAC address of the “virbr0” bridge.

This network setup is suitable for most Ubuntu desktop users, but has limitations. If you want to access guests outside the local network, you need to create a new bridge and configure it so that guest machines can connect to the outside world through the host’s physical interface.

Creating virtual machines

Now that KVM is installed on your Ubuntu desktop, you can create your first virtual machine. This can be done either from the command line or using the virt-manager application.

Download the ISO image of the operating system you want to install and follow these steps to create a virtual machine:

  1. In the “Actions” search bar, type “Virtual Machine Manager” and click the icon to launch the application.
  2. After launching the application, in the top menu, click “File” -> “New virtual machine”:
  3. A new window will appear. Select “Local install media” and click the “Next” button.
  4. Specify the path to the ISO image and click the “Next” button.
  5. On the next screen, select the memory and processor options for the virtual machine. Click Forward.
  6. Then select “Create Disk Image for Virtual Machine” and select the amount of disk space for the virtual machine. Click Forward.
  7. Enter a name for your virtual machine and click Finish.
  8. The VM will boot and a new window will open:How to install KVM on Ubuntu 20.04
    From here, you can follow the onscreen instructions to complete the installation of the operating system.

After installing the operating system, you can access the virtual machine from virt-manager application, via ssh, or through a serial console interface.


We showed you how to install KVM on Ubuntu 20.04 systems. Now you can create your Windows or Linux guests. To learn more about KVM, visit the KVM documentation page.

If you have any questions, please leave a comment below.