We are committed to provide service 24 X 7

Deals, Shopping, Training, Tools

Learn how to – Install KVM on CentOS / RHEL / Ubuntu / Debian / SLES / Arch Linux

Learn how to – Install KVM on CentOS / RHEL / Ubuntu / Debian / SLES / Arch Linux.

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).

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.

#1) Install KVM on CentOS / RHEL 8

Follow the guide in the link below to install KVM on CentOS / RHEL 8 based systems.

#2) Install KVM on CentOS 7 / RHEL 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

#3) Install KVM on Fedora

For KVM check out the guide below:

#4) Install KVM on Ubuntu

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

#5) Install KVM on Debian

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

#6) Install KVM on Arch Linux / Manjaro

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

#7) 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, so what next?. I have a virsh cheat sheet which you can start with:

Bridge configuration on Linux is also a crucial part when working on KVM, an article for this is also available.

If you want to generate KVM VM templates, refer to:

To Automate deployment of VMs on KVM, check:

Further reading:

Cart

Your Cart is Empty

Back To Shop