You might have used VirtualBox or VMware for installing virtual machines in your systems. However, for Linux, there is another virtualization platform known as KVM. KVM stands for Kernel Virtual machine and it is owned by Redhat. It provides a virtual environment where you can run multiple guest OS along with your host operating system and without interfering with its functions. KVM is faster than its counterparts and is open-source.

In this article, we will explain how to install KVM virtualization on the Linux Mint system. Then we will also explain how to create a virtual machine in KVM. We will be using the command line Terminal application for the installation process. To open the command line Terminal, you can use the Ctrl Alt T keyboard shortcut.

Note:

  • We have run the procedure and commands on Linux Mint 20 OS. More or less the same procedure can be followed in older Mint versions.
  • For installing or removing any package in any Linux distribution including Linux Mint, you must be root user or a standard user with sudo privileges.

Installing KVM Virtualization

Follow the below steps to install KVM virtualization in Linux Mint 20 system:

Step 1: Verify processor support for hardware virtualization

For installing KVM, you must have a processor that supports hardware virtualization. You can verify this using the following command in Terminal:

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

Install KVM Virtualization on Linux Mint 20 KVM ubuntu

If the above command returns 0, then it means that the processor does not support hardware virtualization. The value of 1 or greater than it means the processor supports hardware virtualization.

Next, you will need to check whether the virtualization is enabled in the BIOS or not. You can use the kvm-ok command for this purpose which will also tell whether you can run KVM virtual machines in your system or not. To use the kvm-ok, you will need to install the cpu-checker utility. Use the below command to install cpu-checker utility.

$ sudo apt install cpu-checker

Once installed, run kvm-ok:

Install KVM Virtualization on Linux Mint 20 KVM ubuntu

The above output indicates that virtualization is enabled in the BIOS and you can run KVM virtual machines.

If the virtualization is not enabled in the BIOS, then in the output you might receive hints to enable virtualization by entering into BIOS and then hard poweroff/poweron the system.

Step 2: Install KVM

Now install KVM using the following command in Terminal:

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


libvirt-clients bridge-utils virt-manager

When prompted for a password, enter the sudo password.

Install KVM Virtualization on Linux Mint 20 KVM ubuntu

Now you will be asked if you want to continue the installation or not. Hit y to continue the installation process. Once it is finished, move on to the next step.

Step 3: Add the user to ‘libvert’ and ‘kvm’ group

Now you will need to add a user to the ‘libvert’ and ‘kvm’ groups. Issue the following commands in Terminal to do so:

$ sudo usermod -aG libvirt $username


$ sudo usermod -aG kvm $username

Replace the username with the name of the user who will work with KVM.

Now logout and login back to the system to have the user becomes an effective member of the ‘libvert’ and ‘kvm’ groups. This user will be able to run and manage virtual machines.

Step 4: Verify Installation

You can verify the installation with the following command in Terminal:

$ virsh -c qemu:///system list

Install KVM Virtualization on Linux Mint 20 KVM ubuntu

The output above indicates that the installation has been successful. If something goes wrong, you will receive some error in the above output.

Step 5: Create a virtual machine in KVM

Now you can create a virtual machine in KVM using the GUI based Virtual Machine Manager. Also, download the ISO of any OS you want to install in the virtual machine.

To open the Virtual Machine Manager, hit the super key on your keyboard and type virtual machine. From the search results, click on the Virtual Machine Manager icon to open it.

Install KVM Virtualization on Linux Mint 20 KVM ubuntu

When the Virtual Machine Manager will open, you will see the following window.

Install KVM Virtualization on Linux Mint 20 KVM ubuntu

To create a new virtual machine, go to the File menu at the top and then click the New Virtual machine.

Install KVM Virtualization on Linux Mint 20 KVM ubuntu

The following window will appear allowing you to choose the method through which you will install the OS. If you have the ISO file on your system, choose the Local install media (ISO image or CDROM) option and click the Forward button.

Install KVM Virtualization on Linux Mint 20 KVM ubuntu

Next in the following window, click the Browse button to locate the ISO of the OS you want to install in your virtual machine. Then click the Forward button.

Install KVM Virtualization on Linux Mint 20 KVM ubuntu

In the next window, set memory and the number of CPU cores you want to use for the new VM. Then click Forward.

Install KVM Virtualization on Linux Mint 20 KVM ubuntu

Now enable the storage for your virtual machine and once done, click the Forward button.

Install KVM Virtualization on Linux Mint 20 KVM ubuntu

Now type a name for your virtual machine. You can also perform some other configurations here. Once you are done, click the Finish button.

Install KVM Virtualization on Linux Mint 20 KVM ubuntu

Now the VM will be created based on the configurations and the installation options you have provided.

Install KVM Virtualization on Linux Mint 20 KVM ubuntu

Now the OS installation will be started in a new window. Follow the instructions on the screen to complete the installation process. Once the installation is completed, you will be able to run the virtual machine.

That is all there is to it! In this article, you have learned how to install KVM virtualization on Linux Mint 20 system. You have also learned how to create a virtual machine in KVM and install any operating system inside it.

About the author

Install KVM Virtualization on Linux Mint 20 KVM ubuntu

Karim Buzdar

Karim Buzdar holds a degree in telecommunication engineering and holds several sysadmin certifications. As an IT engineer and technical author, he writes for various web sites. You can reach Karim on LinkedIn.