Install KVM on CentOS / RHEL / Ubuntu / Debian / SLES / Arch Linux

Posted on 272 views

This guide will cover the full installation of KVM hypervisor and its management tools on CentOS 7/8, Ubuntu 20.04/18.04/16.04, Debian 10/9, SUSE Linux Enterprise Server 12 and Arch Linux. This list of Linux systems should cover mostly used Linux servers in an enterprise setup.

KVM (for Kernel-based Virtual Machine) is a full virtualization solution for Linux on x86 hardware containing virtualization extensions (Intel VT or AMD-V).

libvirt

It 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. It has received huge adoption on enterprise over the last few years.

Install KVM on CentOS / RHEL 8

How to install KVM on RHEL / CentOS 8

Install KVM on CentOS 7

We’ll install KVM and QEMU plus some tools like libguestfs-tools and virt-top which comes in handy when administering KVM. Install them as below:

sudo yum -y install epel-release
sudo yum -y install gcc libvirt libvirt-devel qemu-kvm virt-install virt-top libguestfs-tools bridge-utils

Confirm that the kernel modules are loaded:

$ sudo lsmod | grep kvm
kvm_intel 147785 0
kvm 464964 1 kvm_intel

Start and enable libvirtd service:

sudo systemctl start libvirtd
sudo systemctl enable libvirtd

Install KVM on Fedora

How to Install KVM on Fedora Linux

Install KVM on Ubuntu 20.04/18.04/16.04

For the Ubuntu system, all packages required to run KVM are available on official upstream repositories. Install them using the commands:

sudo apt update
sudo apt -y install qemu-kvm libvirt-dev bridge-utils libvirt-daemon-system libvirt-daemon virtinst bridge-utils libosinfo-bin libguestfs-tools virt-top

Load and enable the modulevhost-net.

sudo modprobe vhost_net
sudo lsmod | grep vhost
echo "vhost_net" | sudo tee -a /etc/modules

Install KVM on Debian 10/9

Install libvirt daemon, qemu and other KVM related tools using the commands.

sudo apt -y install libvirt-daemon libvirt-dev libosinfo-bin libguestfs-tools libvirt-daemon-system qemu-kvm virtinst bridge-utils virt-top

Load KVM kernel module

$ sudo modprobe vhost_net
$ sudo lsmod | grep vhost
vhost_net 20480 0
tun 28672 1 vhost_net
vhost 45056 1 vhost_net
macvtap 24576 1 vhost_net

$ echo "vhost_net" | sudo tee -a /etc/modules

Install KVM on Arch Linux / Manjaro

For Arch Linux and its derivatives, I already wrote an article which is available on the link below.

Complete Installation of KVM,QEMU and Virt Manager on Arch Linux and Manjaro

Install KVM on SUSE Linux Enterprise Server

The CPU on the system you’re using should have Intel VT or AMD-V function. The install required packages using:

sudo zypper -n install qemu-kvm guestfs-tools virt-top libvirt virt-install libguestfs0 bridge-utils

Ensure the kernel module required to virtualize is on:

$ sudo lsmod | grep kvm 
kvm_intel 147785 0
kvm 464964 1 kvm_intel

Start and enable kvm service:

sudo systemctl start libvirtd  && sudo systemctl enable libvirtd

Basic KVM Operations

Now that you have KVM installed with basic tools you need to get started

coffee

Gravatar Image
A systems engineer with excellent skills in systems administration, cloud computing, systems deployment, virtualization, containers, and a certified ethical hacker.