$$ \Large \mathsf {Installing~KVM} $$

First of all, run the following command to check if the PC is compatible with KVM or not.

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

If the result shows 0 it means that your CPU doesn't support hardware virtualization.

If the result shows 1 or more then it does support KVM but you still need to make sure that virtualization is enabled in the BIOS.

Untitled

Here my PC is showing 8, which means it supports virtualization and I have already enabled my virtualization previously from my BIOS. Now it is time to do the following steps one by one.

  1. Install KVM and other essential components → Open the terminal and paste the following command to install KVM and other necessary packages. it will show something like the following screenshot after the code. I had already installed KVM on my PC, which is why it is showing already installed. Your one might show a different output. In the following command, I also installed virt-managerand virtinst, which will install the GUI of the virtual manager. Virtual machines can be created and run using the command line, so if you want you can remove both of those commands and only install the essential components to run KVM.
sudo apt install -y qemu-kvm virt-manager libvirt-daemon-system virtinst libvirt-clients bridge-utils

Untitled

  1. Checking hardware compatibility → The kvm-ok command is typically used to check if the KVM virtualization extensions are available and properly configured on your system.

This command should show something like the following screenshot, if you do not get the same output, run the installation command again.

kvm-ok

Untitled

  1. Granting necessary permission → Adding current users to the libvirt and kvm groups to grant the necessary permissions.
sudo adduser $USER libvirt
sudo adduser $USER kvm

It will show something like this.

Untitled

Here my$USER is sakib_sadman and as I had previously installed KVM on my machine, I had this user added to the libvert and KVM already. That is why it is showing already added, your one might show a different output.

  1. Starting and enabling the virtualization daemon → Start and enable the libvirt daemon using the following command.