Changes

Jump to: navigation, search

Installing KVM Virtualization on RHEL

7,941 bytes added, 19:15, 10 June 2019
Created page with "{{#pagetitle: Installing Virtualization on RHEL 8 }} <table border="0" cellspacing="0" width="100%"><tr> <td width="20%">Previous<..."
{{#pagetitle: Installing Virtualization on RHEL 8 }}
<table border="0" cellspacing="0" width="100%"><tr>
<td width="20%">[[An Overview of Virtualization Techniques|Previous]]<td align="center">[[Red Hat Enterprise Linux Essentials|Table of Contents]]<td width="20%" align="right">[[Creating KVM Virtual Machines on RHEL using Cockpit and virt-manager|Next]]</td>
<tr>
<td width="20%">An Overview of Virtualization Techniques<td align="center"><td width="20%" align="right">Creating KVM Virtual Machines on RHEL 8 using Cockpit and virt-manager</td>
</table>
<hr>


<htmlet>rhel8</htmlet>


Prior to RHEL 6 two virtualization platforms were provided with RHEL in the form of Kernel-based Virtual Machine (KVM) and Xen. With the release of RHEL 6, support for Xen was removed leaving KVM as the only bundled virtualization option supplied with RHEL 8. In addition to KVM, third party solutions are available in the form of products such as VMware and Oracle VirtualBox. Since KVM is supplied with RHEL 8, however, this is the virtualization solution that will be covered in this and subsequent chapters.

Before plunging into installing and running KVM it is worth taking a little time to talk about how it fits into the various types of virtualization outlined in the previous chapter.

== An Overview of KVM ==

KVM is categorized as a Type-1 hypervisor virtualization solution that implements full virtualization with support for unmodified guest operating systems using Intel VT and AMD-V hardware virtualization support.

KVM differs from many other Type-1 solutions in that it turns the host Linux operating system itself into the hypervisor, allowing bare metal virtualization to be implemented while still running a full, enterprise level host operating system.

== KVM Hardware Requirements ==

Before proceeding with this chapter we need to take a moment to discuss the hardware requirements for running virtual machines within a KVM environment. First and foremost, KVM virtualization is only available on certain processor types. As previously discussed, these processors must include either Intel VT or AMD-V technology.

To check for virtualization support, run the following command in a terminal window:

<pre>
# lscpu | grep Virtualization:
</pre>

If the system contains a CPU with Intel VT support, the above command will provide the following output:

<pre>
Virtualization: VT-x
</pre>

Alternatively, the following output will be displayed when a CPU with AMD-V support is detected:

<pre>
Virtualization: AMD-V
</pre>

If the CPU does not support virtualization, no output will displayed by the ''lscpu'' command.

Note that while the above commands only report whether the processor supports the respective feature, it does not indicate whether the feature is currently enabled in the BIOS. In practice virtualization support is typically disabled by default in the BIOS of most systems. It is recommended, therefore, that you check your BIOS settings to ensure the appropriate virtualization technology is enabled before proceeding with this tutorial.

Unlike a dual booting environment, a virtualized environment involves the running of two or more complete operating systems concurrently on a single computer system. This means that the system must have enough physical memory, disk space and CPU processing power to comfortably accommodate all these systems in parallel. Before beginning the configuration and installation process check on the minimum system requirements for both RHEL 8 and your chosen guest operating systems and verify that your system has sufficient resources to handle the requirements of both systems.

== Preparing RHEL 8 for KVM Virtualization ==

Unlike Xen, it is not necessary to run a special version of the kernel in order to support KVM. As a result KVM support is already available for use with the standard kernel via the installation of a KVM kernel module, thereby negating the need to install and boot from a special kernel.

To avoid conflicts, however, if a Xen enabled kernel is currently running on the system, reboot the system and select a non-Xen kernel from the boot menu before proceeding with the remainder of this chapter.

The tools required to setup and maintain a KVM-based virtualized system are not installed by default unless specifically selected during the RHEL 8 operating system installation process. To install KVM from the command prompt, execute the following command in a terminal window:

<pre>
# dnf install qemu-kvm qemu-img libvirt virt-install libvirt-client
</pre>

If you have access to a graphical desktop environment the ''virt-manager'' package is also recommended:

<pre>
# dnf install virt-manager
</pre>

== Verifying the KVM Installation ==

It is worthwhile checking that the KVM installation worked correctly before moving forward. When KVM is installed and running, two modules will have been loaded into the kernel. The presence or otherwise of these modules can be verified in a terminal window by running the following command:

<pre>
# lsmod | grep kvm
</pre>

Assuming that the installation was successful the above command should generate output similar to the following:

<pre>
# lsmod | grep kvm
kvm_intel 237568 0
kvm 737280 1 kvm_intel
irqbypass 16384 1 kvm
</pre>

Note that if the system contains an AMD processor the kvm module will likely read ''kvm_amd ''rather than ''kvm_intel''.

The installation process should also have configured the libvirtd daemon to run in the background. Once again using a terminal window, run the following command to ensure libvirtd is running:

<pre>
# systemctl status libvirtd
libvirtd.service - Virtualization daemon
Loaded: loaded (/usr/lib/systemd/system/libvirtd.service; enabled; vendor preset: enabled)
Active: active (running) since Wed 2019-03-06 14:41:22 EST; 3min 54s ago
</pre>

If the process is not running, it may be started as follows:

<pre>
# systemctl enable --now libvirtd
# systemctl start libvirtd
</pre>

If the desktop environment is available, run the ''virt-manager'' tool by selecting Activities and entering “virt” into the search box. When the Virtual Machine Manager icon appears, click on it to launch it. When loaded, the manager should appear as illustrated in the following figure:


[[File:rhel_8_virt-manager.png]]


Figure 20-1

If the QEMU/KVM entry is not listed, select the ''File -&gt; Add Connection'' menu option and, in the resulting dialog, select the QEMU/KVM Hypervisor before clicking on the Connect button:


[[File:rhel_8_virt-manager_add_connection.png]]


Figure 20-2

If the manager is not currently connected to the virtualization processes, right-click on the entry listed and select Connect from the popup menu.

== Summary ==

KVM is a Type-1 hypervisor virtualization solution that implements full virtualization with support for unmodified guest operating systems using Intel VT and AMD-V hardware virtualization support. It is the default virtualization solution bundled with RHEL 8 and can be installed quickly and easily on any RHEL 8 system with appropriate processor support. With KVM support installed and enabled, the next few chapters will outline some of the options for installing and managing virtual machines on a RHEL 8 host.


<htmlet>rhel8</htmlet>


<hr>
<table border="0" cellspacing="0" width="100%"><tr>
<td width="20%">[[An Overview of Virtualization Techniques|Previous]]<td align="center">[[Red Hat Enterprise Linux Essentials|Table of Contents]]<td width="20%" align="right">[[Creating KVM Virtual Machines on RHEL using Cockpit and virt-manager|Next]]</td>
<tr>
<td width="20%">An Overview of Virtualization Techniques<td align="center"><td width="20%" align="right">Creating KVM Virtual Machines on RHEL 8 using Cockpit and virt-manager</td>
</table>

Navigation menu