Install KVM on Linux Mint (Part 1)
What is about?
This blog is about installing and setting up KVM on Linux Mint(a Ubuntu distro), then install a Rocky Linux(a RHEL distro) VM via command line. I am referring to this blog for steps.
What is KVM?
According to the wiki, KVM - Kernel-base Virtual Machine is a free open source virtualization module in the Linux Kernel that allows the kernel to function as a hypervisor. It was merged into the mainline Linux Kernel in 2007. KVM requires a CPU with hardware virtualization extensions such as Intel VT and AMD-V.
Installing KVM
I assume you that have some understanding about Linux, shell commands, installing an Linux OS to continue on reading.
Step 1. Check CPU virtualization support
Open terminal, run the lscpu command to list CPU information. Flag “vmx” is from Intel CPUs and flag “svm” is from AMD CPUs.
lscpu | grep -E 'vmx|svm'
Step 2. Enable virtualization in BIOS/UEFI
In new computer, UEFI replaces BIOS for computer hardware bootstrap. Here my laptop is on UEFI and I can press F2
to enter into UEFI to enable CPU hardware virtualization.
You can do this by rebooting your machine and pressing keys like F2
, F10
or Delete
to enter into BIOS/UEFI. Different keys depend on different manufacturers.
Step 3. Install KVM packages
The main ones are libvirt
a lib for KVM virtualization and virt-manager
which is its GUI. In Linux Mint and other Ubuntu distros, we use the built-in apt to install packages.
sudo apt update
sudo apt install -y qemu-kvm libvirt-daemon-system libvirt-clients bridge-utils virt-manager
Step 4.1. Verify KVM installation
After apt exits successfully, your system should have command virsh
, run the command to verify KVM installation.
sudo virsh list --all
Expect to return without errors.
Step 4.2 Verify libvirtd daemon starting
The service libvirtd
is the daemon should be starting by systemd. Verify whether it is starting
sudo systemctl status libvirtd
If not starting, run this
sudo systemctl enable libvirtd
sudo systemctl start libvirtd
Step 4.3 Verify Linux kernel module
Run this
lsmod | grep kvm
Expect to see something like “kvm_intel” if your machine is with Intel CPU.
Step 5 Add your current user to KVM and libvirt group
Your current user has to be in groups kvm
and libvirt
so that you are granted to manage virtual machines.
Run this
sudo usermod -aG kvm,libvirt $USER
newgrp libvirt
Command newgrp
logs current user in a new group.
Step 6 Configure networking for VM
KVM connects to the network or the internet from your host OS. NAT (aka Network Address Translation) is the default one and suits for most basic setups.
Network address translation (NAT) is a method of mapping an IP address space into another by modifying network address information in the IP header of packets while they are in transit across a traffic routing device.[1] The technique was initially used to bypass the need to assign a new address to every host when a network was moved, or when the upstream Internet service provider was replaced but could not route the network’s address space. It has become a popular and essential tool in conserving global address space in the face of IPv4 address exhaustion. One Internet-routable IP address of a NAT gateway can be used for an entire private network.
To talk about NAT is another deep topic, I may separate into another blog to explain it.

sudo virsh net-list --all
Expect to see default is active state. Default is NAT.
If not seeing active, run
sudo virsh net-start default
sudo virsh net-autostart default
Step 7 Launching Virtual Machine Manager
The installation includes the GUI for Virtual Machine Manager. Start it from command line
sudo virt-manager

Horray! Installation accomplished!
Summary
I pause and postpone to create VM for Rocky Linux at this point as I’ve found that the blog is already too wordy. I wrap up this as the Part 1. I will write Part n for the other content.
In summary, this blog walks you through steps to install KVM on Linux Mint. Related software and packages are associated with links to extensive content in the internet. You can opt to read them if you are interested to learn more.
On rule of thumb, for linux commands, if you are using Linux, you can run man <command>
that shows you comprehensive document for the command. You can learn the command from man
, that is a good and convenient way.