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.
- 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:
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.
Once installed, run kvm-ok:
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:
libvirt-clients bridge-utils virt-manager
When prompted for a password, enter the sudo password.
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 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:
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.
When the Virtual Machine Manager will open, you will see the following window.
To create a new virtual machine, go to the File menu at the top and then click the New Virtual machine.
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.
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.
In the next window, set memory and the number of CPU cores you want to use for the new VM. Then click Forward.
Now enable the storage for your virtual machine and once done, click the Forward button.
Now type a name for your virtual machine. You can also perform some other configurations here. Once you are done, click the Finish button.
Now the VM will be created based on the configurations and the installation options you have provided.
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.