How To Install KVM on Ubuntu 20.04 LTS

Install KVM on Ubuntu 20.04

In this tutorial, we will show you how to install KVM on Ubuntu 20.04 LTS. For those of you who didn’t know, KVM (Kernel-based Virtual Machine) is the virtualization solution for Linux. It consists of a loadable kernel module that allows the Linux Kernel to work as a Hypervisor. KVM provides hardware-assisted virtualization for a wide variety of guest operating systems.

This article assumes you have at least basic knowledge of Linux, know how to use the shell, and most importantly, you host your site on your own VPS. The installation is quite simple and assumes you are running in the root account, if not you may need to add ‘sudo‘ to the commands to get root privileges. I will show you through the step-by-step installation of the KVM virtualization on Ubuntu 20.04 (Focal Fossa). You can follow the same instructions for Ubuntu 18.04, 16.04, and any other Debian-based distribution like Linux Mint.

Install KVM on Ubuntu 20.04 LTS Focal Fossa

Step 1. First, make sure that all your system packages are up-to-date by running the following apt commands in the terminal.

sudo apt update
sudo apt upgrade

Step 2. Installing KVM on Ubuntu 20.04.

Before you begin with installing KVM, check if your CPU supports hardware virtualization:

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

The output of the above command is very important. An output of 1 or anything greater than that shows that your CPU can be set-up for using the virtualization technology. An output of 0 indicates the inability of your system to run KVM.

If you wish to verify whether your server is capable of running KVM virtual machines then install “kvm-ok” utility using below apt command:

sudo apt install cpu-checker

Check if your system can run KVM:

sudo kvm-ok

Then, install essential KVM packages with the following command:

sudo apt install qemu-kvm libvirt-bin bridge-utils virtinst virt-manager

Verify the KVM Status:

sudo systemctl is-active libvirtd

Step 3. Create Virtual Machines.

Now we open the Virtual Machine Manager by typing the same in Dash Home. Click the icon, it will open the application.

Install KVM on Ubuntu 20.04

In the virtual machine manager window, click the first icon in the toolbar.

Install KVM on Ubuntu 20.04

Next, choose the location of your installation media.

Install KVM on Ubuntu 20.04

You can install it from a disc, ISO image, or even a network location.

Install KVM on Ubuntu 20.04

Next, allocate memory and CPU to your virtual machine.

Install KVM on Ubuntu 20.04

After that, specify the size of your virtual disk. If you check the box before allocate the entire disk now, then the disk size is fixed.

Install KVM on Ubuntu 20.04

In the next window, you can give your virtual machine a name. Then click finish to begin installing OS to your virtual machine.

Install KVM on Ubuntu 20.04

Here’s a screenshot of the Ubuntu virtual machine running in virt-manager window.

Install KVM on Ubuntu 20.04

Congratulations! You have successfully installed KVM. Thanks for using this tutorial for installing the KVM virtualization on Ubuntu 20.04 LTS Focal Fossa system. For additional help or useful information, we recommend you check the official KVM website.

VPS Manage Service Offer
If you don’t have time to do all of this stuff, or if this is not your area of expertise, we offer a service to do “VPS Manage Service Offer”, starting from $10 (Paypal payment). Please contact us to get the best deal!