How to Install KVM on Ubuntu 22.04: A Step-by-Step Guide

Learn how to install KVM on Ubuntu 22.04 and harness the power of virtualization. Follow our step-by-step guide to set up KVM and start creating virtual machines on your Ubuntu system.

In this article, we will explore the process of installing KVM (Kernel-based Virtual Machine) on Ubuntu 22.04. KVM is a virtualization technology that allows you to create and manage virtual machines on your Ubuntu system. By following the steps outlined below, you will be able to set up KVM and start utilizing its powerful virtualization capabilities.


Before we begin the installation process, there are a few prerequisites that you need to ensure are met:

  1. Ubuntu 22.04: Make sure you have a running instance of Ubuntu 22.04 on your system.
  2. Hardware virtualization support: Verify that your CPU supports hardware virtualization. You can do this by checking the BIOS settings of your system.
  3. Sufficient resources: Ensure that you have enough RAM, disk space, and CPU power to allocate to your virtual machines.

Step 1: Update the System

To begin, let’s update our Ubuntu system to ensure that we have the latest packages and security patches. Open a terminal and run the following commands:

sudo apt update
sudo apt upgrade -y

Step 2: Install KVM Packages

Next, we need to install the necessary KVM packages. Open a terminal and enter the following command:

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

This command will install the KVM hypervisor, along with additional tools and utilities required for managing virtual machines.

Step 3: Verify Installation

After the installation is complete, we can verify that KVM is installed correctly. Run the following command in the terminal:

sudo kvm-ok

If everything is set up correctly, you should see the message “KVM acceleration can be used” indicating that KVM is installed and ready to use.

Step 4: Configure Networking

To ensure that our virtual machines have network connectivity, we need to configure the network bridge. Open a terminal and enter the following command:

sudo nano /etc/netplan/01-netcfg.yaml

This will open the network configuration file in the Nano text editor. Locate the section that starts with “network:” and add the following lines:

                interfaces: [enp0s3]
                dhcp4: true

Replace “enp0s3” with the name of your network interface. Save the file and exit the editor.

Next, apply the changes by running the following command:

sudo netplan apply

Step 5: Start the Libvirt Service

To start the Libvirt service, which is responsible for managing virtual machines, enter the following command in the terminal:

sudo systemctl enable --now libvirtd

This will enable the service and start it immediately.

Step 6: Launch the Virtual Machine Manager

Finally, we can launch the Virtual Machine Manager, a graphical tool for managing virtual machines. Open the application menu and search for “Virtual Machine Manager” or run the following command in the terminal:


The Virtual Machine Manager allows you to create, configure, and manage virtual machines with ease.


Congratulations! You have successfully installed KVM on Ubuntu 22.04. You are now ready to start creating and managing virtual machines on your system. Feel free to explore the various features and capabilities that KVM offers, and enjoy the benefits of virtualization.

Remember to regularly update your Ubuntu system and keep your virtual machines secure. Happy virtualizing!

Must Read

Related Articles