This guide will cover the full installation of KVM hypervisor and its management tools on Fedora 32/31/30/29. KVM (Kernel-based Virtual Machine) is a full virtualization solution for Linux Systems running on x86 hardware with virtualization extensions (Intel VT or AMD-V).
KVM consists of a loadable kernel module,
kvm.ko, that provides the core virtualization infrastructure and a processor specific module, kvm-intel.ko or kvm-amd.ko.
Install KVM on Fedora 32/31/30/29
In this section, we’ll cover all the steps to install the latest release of KVM hypervisor on Fedora. We’ll also include the installation of management tools like
Step 1: Ensure your CPU has Intel VT or AMD-V Virtualization extensions
The first step is to confirm that your CPU has either Intel VT or AMD-V Virtualization extensions. In some systems, this is disabled on BIOS and you may need to enable it.
$ cat /proc/cpuinfo | egrep "vmx|svm"
Step 2: Install KVM / QEMU on Fedora 32/31/30/29
Install required virtualization packages on your Fedora system by running:
sudo dnf -y install bridge-utils libvirt virt-install qemu-kvm
After installation, verify that Kernel modules are loaded
$ lsmod | grep kvm kvm_intel 233472 0 kvm 737280 1 kvm_intel
Also install useful tools for virtual machine management.
sudo dnf -y install virt-top libguestfs-tools
We have a guide on how to use
Step 3: Start and enable KVM daemon
By default, KVM daemon
libvirtd is not started, start the service using the command:
sudo systemctl start libvirtd
Then enable the service to start on boot
sudo systemctl enable libvirtd
Step 4: Install Virtual machine Manager GUI
If you have a Desktop version of Fedora, you can install
virt-manager which gives users a GUI interface to manage your Virtual Machines.
sudo dnf -y install virt-manager
Step 5: Create a test instance
First start by creating a bridge network to be attached to your instances, below guides should help.
Once you have your bridge interface ready, create a test instance using CLI or Virtual Machine Manager.
$ virt-install \ --name fed31 \ --ram 1024 \ --vcpus 1 \ --disk path=/var/lib/libvirt/images/fed31.img,size=20 \ --os-variant fedora31 \ --os-type linux \ --network bridge=br0 \ --graphics none \ --console pty,target_type=serial \ --location 'http://fedora.inode.at/releases/31/Server/x86_64/os/' \ --extra-args 'console=ttyS0,115200n8 serial'
The installation is on text mode but the procedure of installation is similar to GUI. After finishing the installation, reboot the instance and login
Fedora 31 (Server Edition) Kernel 5.5.8-200.fc31.x86_64 on an x86_64 (ttyS0) Web console: https://localhost:9090/ or https://192.168.10.11:9090/ localhost login:
You can also login through console:
$ virsh console fed31
Press <ENTER> key on getting:
Escape character is ^]
If you want to generate KVM VM templates, refer to How to Create CentOS / Fedora / RHEL VM Templates on KVM
See our Virsh Commands cheat sheet for a complete list of virsh commands
Want to Automate VMs deployment on KVM?, check out How to Provision VMs on KVM with Terraform