Sunday, September 22, 2024
Google search engine
HomeGuest BlogsHow To Install KVM on RHEL 8 / CentOS 8 Linux

How To Install KVM on RHEL 8 / CentOS 8 Linux

How to install KVM on RHEL 8 / CentOS 8?. This guide will cover the full installation of KVM hypervisor and its management tools onĀ  RHEL 8 / CentOS 8. 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. Follow the steps below to install KVM on your RHEL 8 server.

For VirtualBox: Installing VirtualBox on CentOS 8 / RHEL 8

Install KVM on RHEL 8 / CentOS 8 Linux

The next sections will take you throughĀ the steps to install the latest release of KVM hypervisor on RHEL 8. This will include the installation of KVM management tools ā€“Ā libguestfs-tools

Step 1: Check Intel VT or AMD-V Virtualization extensions

The first step is to verify your CPU support for 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"

You can also do the same withĀ lscpuĀ command

$Ā lscpu | grep Virtualization
Virtualization: VT-x

Step 2: Install KVM / QEMU on RHEL/ CentOS 8

Upgrade your system packages.

sudo yum update -y

Then perform a reboot after an upgrade.

sudo shutdown -r now

KVM packages are distributed on RHEL 8 via AppStream repository. Install KVM on your RHEL 8 server by running the following commands:

sudo dnf -y install epel-release
sudo yum -y  install @virt

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Ā libvirt-devel virt-top libguestfs-tools bridge-utils

We have a guide on how to useĀ libguestfs-toolsĀ like:

Step 3: Start and enable KVM daemon

By default, KVM daemonĀ libvirtdĀ is not started, start the service using the command:

sudoĀ systemctl enable --now libvirtd

Step 4: Install Virtual machine Manager GUI ā€“ Optional

If you have a Desktop Environment on your RHEL 8, you can install theĀ virt-managerĀ tool which allows you to manage Virtual Machines from a GUI.

sudo yum -y installĀ virt-manager

Another option is to use Cockpit, check out below article.

Step 5: Create a VM instance on KVM

First, start by creating a network bridge to be attached to your instances.

You can also refer to our guides below.

Once you have yourĀ bridge interface ready, create a test instance using CLI or Virtual Machine Manager. The example below is for creating a Fedora VM.

sudo virt-install \
--name fed \
--ram 2048 \
--vcpus 2 \
--disk path=/var/lib/libvirt/images/fed38.img,size=20 \
--os-variant fedora38 \
--os-type linux \
--network bridge=virbr0 \
--graphics none \
--console pty,target_type=serial \
--location 'https://fedora.mirror.liquidtelecom.com/fedora/linux/releases/38/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 38 (Server Edition)

Web console: https://localhost:9090/ or https://192.168.10.11:9090/

localhost login:

You can also login through console:

virsh console fed

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

You now have KVM installed on RHEL 8. Enjoy your Virtualization with RHEL 8 and 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

For installation through Virtual Machine Manager GUI, you may need toĀ configure virt-manager as a non-root user on Linux

Also checkĀ RHEL and CentOS Kickstart on KVM Automated Installation With virt-install

Further reading:

Mastering KVM Virtualization

Virtualization Essentials, 2nd Edition

RELATED ARTICLES

Most Popular

Recent Comments

ź°•ģ„œźµ¬ģ¶œģž„ė§ˆģ‚¬ģ§€ on How to store XML data into a MySQL database using Python?
źøˆģ²œźµ¬ģ¶œģž„ė§ˆģ‚¬ģ§€ on How to store XML data into a MySQL database using Python?
ź“‘ėŖ…ģ¶œģž„ģ•ˆė§ˆ on How to store XML data into a MySQL database using Python?
ź“‘ėŖ…ģ¶œģž„ģ•ˆė§ˆ on How to store XML data into a MySQL database using Python?
ė¶€ģ²œģ¶œģž„ģ•ˆė§ˆ on How to store XML data into a MySQL database using Python?
źµ¬ģ›”ė™ģ¶œģž„ģ•ˆė§ˆ on How to store XML data into a MySQL database using Python?
ź°•ģ„œźµ¬ģ¶œģž„ģ•ˆė§ˆ on How to store XML data into a MySQL database using Python?
ģ˜¤ģ‚°ģ¶œģž„ģ•ˆė§ˆ on How to store XML data into a MySQL database using Python?
ź“‘ėŖ…ģ¶œģž„ė§ˆģ‚¬ģ§€ on How to store XML data into a MySQL database using Python?
ģ•ˆģ–‘ģ¶œģž„ė§ˆģ‚¬ģ§€ on How to store XML data into a MySQL database using Python?
ė¶€ģ²œģ¶œģž„ģ•ˆė§ˆ on How to store XML data into a MySQL database using Python?
ė™ķƒ„ģ¶œģž„ģ•ˆė§ˆ on How to store XML data into a MySQL database using Python?
ģ„œģšøģ¶œģž„ģ•ˆė§ˆ on How to store XML data into a MySQL database using Python?
ė¶„ė‹¹ģ¶œģž„ģ•ˆė§ˆ on How to store XML data into a MySQL database using Python?
ė¶€ģ²œģ¶œģž„ģ•ˆė§ˆ on How to store XML data into a MySQL database using Python?
ķ™”ź³”ė™ģ¶œģž„ė§ˆģ‚¬ģ§€ on How to store XML data into a MySQL database using Python?
ź°•ģ„œźµ¬ģ¶œģž„ė§ˆģ‚¬ģ§€ on How to store XML data into a MySQL database using Python?
ź³ ģ–‘ģ¶œģž„ģ•ˆė§ˆ on How to store XML data into a MySQL database using Python?
ķ™”ģ„±ģ¶œģž„ė§ˆģ‚¬ģ§€ on How to store XML data into a MySQL database using Python?
ģ²œķ˜øė™ģ¶œģž„ė§ˆģ‚¬ģ§€ on How to store XML data into a MySQL database using Python?