This article explains how to install KVM on Ubuntu 20.04.
KVM (Kernel-based Virtual Machine) is an open-source complete virtualization solution for Linux systems, including Ubuntu. Like VirtualBox and VMware Workstation, KVM is a virtualization infrastructure for the Linux kernel that turns it into a hypervisor.
Since KVM is part of the Linux kernel, it benefits from its features, security, and updates.
If you can’t install VirtualBox or VMware Workstation virtualization solutions on Ubuntu machines, you can try KVM instead. After installing, use the KVM module to install and run multiple virtual machines (guest) on Linux servers.
These virtual machines can be managed via the virt-manager graphical user interface or virt-install & virsh CLI commands.
Check KVM Support on Ubuntu
Not all systems can install and run the KVM modules. If you’re running a server that isn’t compatible, KVM can’t be used on it.
To check, run the commands below to install a CPU checker tool on Ubuntu Linux.
sudo apt install cpu-checker sudo kvm-ok
After installing the above commands, check the CPU compatibility with KVM. If KVM is compatible, you should get the message that KVM acceleration can be used.
INFO: /dev/kvm exists
KVM acceleration can be used
if KVM isn’t compatible with your system, you’ll get a message that reads
INFO: Your CPU does not support KVM extensions
KVM acceleration can NOT be used
The message above shows you can’t run KVM.
Install KVM Packages
If step 1 is good, run the commands below to install KVM packages to enable full virtualization functionality on Ubuntu via the Linux kernel.
sudo update
sudo apt install qemu-kvm virt-manager libvirt-clients bridge-utils libvirt-daemon-system virtinst
After installing the KVM modules, run the commands below to start and enable it to start automatically when the system boots.
sudo systemctl start libvirtd sudo systemctl enable libvirtd
Add a User to libvirt and KVM Groups
When you install KVM on Ubuntu, you should also add your user account to the libvirt and KVM groups. Doing this will allow you to create and manage the Virtual machines on your system.
Run the command below to add your account to these groups.
sudo usermod -aG libvirt $USER
sudo usermod -aG kvm $USER
Create New VMs
Now that the server is configured open the KVM virtual machine manager and create a new virtual guest machine.
First, connect to the server, then create a new machine by clicking New Virtual Machine.

Then, choose how to install the guest machine. You can use local ISO media or install it via network / PXE.

After selecting the OS file, continue to create a setup of a local disk, system memory, and other settings.

When you’re done, boot the VM to install Ubuntu

That should do it!
Conclusion:
- KVM provides an efficient and powerful virtualization solution for Ubuntu 20.04 users.
- It allows creating and managing multiple virtual machines, leveraging the Linux kernel’s capabilities.
- Users can choose from various installation sources, including local ISOs and network installations.
- Adding user accounts to the appropriate groups ensures smooth management of virtual machines.
- With tools like virt-manager, users can easily configure and monitor their virtual environments.
- KVM is a robust alternative for users unable to utilize VirtualBox or VMware, emphasizing performance and integration with Linux systems.
Leave a Reply