Hello, and welcome to today's video presentation on Enabling KVM on Oracle Linux 8.
In this video, we will provide a background on KVM, show how to verify the KVM modules
are loaded, install the virtualization packages, and validate the environment is ready to host
VMs.
So let us get started.
Kernel-based Virtual Machine (KVM) is an open-source type-1 (bare-metal) hypervisor.
This functionality permits a host system, such as Oracle Linux 8, to host multiple virtual
machines (VMs) or guests when running on supported hardware.
These VMs use the host's physical hardware to virtualize an operating system as a regular
Linux user-space process.
The KVM code was first announced in 2006 and merged into the mainline kernel as part of
version 2.6.20 in February 2007.
Therefore, KVM is part of Linux.
It implements a host kernel module along with a processor-specific module that supports
x86 hardware with virtualization extensions (Intel VT or AMD-V).
There are several benefits of using KVM in the enterprise.
KVM uses a combination of security-enhanced Linux (SELinux) and secure virtualization
(sVirt) for enhanced VM security and isolation.
KVM can use any storage supported by Linux, including some local disks and network-attached
storage (NAS).
KVM implements nested virtualization or running a VM inside another VM.
Although it is possible to manually manage a handful of VMs running on a single workstation
without a management tool, large enterprises traditionally use virtualization management
software.
That software interfaces with virtual environments and the underlying physical hardware to simplify
resource administration, enhance data analyses, and streamline operations.
Oracle has Oracle Linux Virtualization Manager for this exact purpose.
More details on Oracle Linux Virtualization Manager is available in the Oracle Documentation
or Oracle Linux Virtualization Manager Training.
Now that we have a general understanding of KVM, time for getting it running.
For this demo, I use a Bare Metal Oracle Cloud instance patched to Oracle Linux 8.2.
For physical or on-premise systems, you use the same steps.
Connect to the system's terminal and validate that the hardware supports virtualization.
For Intel systems, type grep -e 'vmx' /proc/cpuinfo.
For AMD systems, type grep -e 'svm' /proc/cpuinfo.
If you do not know your CPU type, you can type grep -e 'vendor_id'/proc/cpuinfo to get
this information.
This system is Intel-based, shown by the output of GenuineIntel.
It also supports virtualization by the existence of the vmx flag.
Next, check for the loaded KVM modules.
Type lsmod | grep kvm
The output displays the KVM kernel module and the kvm_intel processor module based on
this system's hardware.
These modules should load by default on modern Linux systems.
Now that we know the system supports virtualization, we need to install the software packages associated
with the Oracle Linux 8 virtualization module.
Type sudo dnf module install virt.
This command installs the collection of virtualization packages, which include libvirt, qemu-kvm,
and other dependencies.
To display the details of what the module installs run sudo dnf info virt.
Next, install virt-install and virt-viewer by typing sudo dnf install virt-install virt-viewer.
That completes the install of the required set of packages.
Validate the host machine is ready and set up to run libvirt VMs by typing virt-host-validate.
Note that libvirt is an open-source toolkit for managing virtualization platforms such
as KVM.
If all checks PASS, then the system is prepared for created VMs.
If any checks FAIL, follow the instruction to correct the problem.
If any check returns the value of WARN, then consider following the instructions to improve
the virtualization capabilities.
If you get the message: QEMU: Checking for hardware virtualization: FAIL (Only emulated
CPUs are available, performance will be significantly limited), then creating VMs will fail rather
than have performance problems.
Next, start the libvirtd daemon and enable it to start on each boot automatically.
Type
sudo systemctl start libvirtd.service
Then
sudo systemctl enable libvirtd.service
Lastly, check the service status with sudo systemctl status libvirtd.service.
The libvirtd service is now running, and we are ready to create VMs.
Thank you for watching this video and enjoy using KVM on Oracle Linux 8.
Please check our additional information on Oracle Linux 8 in the Oracle Linux 8 Documentation
or Oracle Linux Learning Library.