Install KVM on Ubuntu 20.04 LTS Desktop

KVM (for Kernel-based Virtual Machine) is a virtualization software.By using KVM you can create Virtual Machine. The Virtualization software like KVM and Virtual box are quite popular and heavily used by professionals.
This post will guide you through how to install KVM on Ubuntu 20.04 LTS Desktop. This post is going to be very quick. Suggest here to read our previous post on installing KVM on Ubuntu 14.04 LTS. which has some good details.

Prerequisites

  • CPU should support virtualization
    Command: egrep -c '(vmx|svm)' /proc/cpuinfo
    If output is more than 1 (numeric value) then it supports VT (Virtualization Technology).
  • Operating System Architecture:
    Command: arch
    x86_64 represents 64 bit kernel.
    i386, i486, i586 or i686 represents 32 bit kernel

    Note: On 32 bit kernel, given below are limitations.
    – You can only install 32 bit Operating System on host VM.
    – we will be limited to allocate 2GB RAM maximum at to the VM.

Installation Steps of KVM (Virtualization Software) on Ubuntu 20.04 LTS

Follow these steps to install KVM.

Step 1:

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

Step 2: Add you current login user to group called libvirt and kvm. These two groups were get created when we have installed the packages given in above Step 1.

sudo adduser `id -un` libvirt
sudo adduser `id -un` kvm

Now by using below given command you can see in output that your current login user is member of how many groups.

sudo grep `id -un` /etc/group

Step 3: Verify the KVM working status.
When you run the below command it should show output like this. In case of any error, we suggest to logout and login back to your system.

virsh list --all

Below screenshot depicts our expected output. Because we have not created any VM here, it is blank.

kvm ubuntu
install kvm on ubuntu

Step 4(Optional) To manage your KVM through GUI install the Virt-manager package.

sudo apt install virt-manager

Once virt-manager package is installed you can start using the KVM from GUI.
To open Virt-Manager, either you can directly run command virt-manager or open from Dash home search by typing virt-manager.

virt-manager gui
install virt-manager on ubuntu linux

Now you are ready to use the KVM.