Bookmark this page

Install and Configure Virtual Machines

Objectives

  • Install a virtual machine on your Red Hat Enterprise Linux server with the web console.

Introducing KVM Virtualization

Virtualization is a feature to support dividing a single physical machine into multiple virtual machines (VM), each of which can run an independent operating system.

Red Hat Enterprise Linux supports KVM (Kernel-based Virtual Machine), a full virtualization solution that is built into the standard Linux kernel. KVM can run multiple Windows and Linux guest operating systems.

Figure 12.4: KVM virtualization

In Red Hat Enterprise Linux, you can manage KVM from the command line with the virsh command, or graphically with the web console's Virtual Machines tool.

KVM virtual machine technology is available across all Red Hat products, from stand-alone physical instances of Red Hat Enterprise Linux to the Red Hat OpenStack Platform:

  • Physical hardware systems run Red Hat Enterprise Linux to provide KVM virtualization. Red Hat Enterprise Linux is typically a thick host, a system that supports VMs and also providing other local and network services, applications, and management functions.

  • Red Hat Virtualization (RHV) provides a centralized web interface that administrators can use to manage an entire virtual infrastructure. It includes advanced features such as KVM migration, redundancy, and high availability. A Red Hat Virtualization Hypervisor is a tuned version of Red Hat Enterprise Linux solely for provisioning and supporting VMs.

  • Red Hat OpenStack Platform (RHOSP) provides the foundation to create, deploy, and scale a public or a private cloud.

  • Red Hat OpenShift Virtualization includes RHV components to enable deployment of containers on bare metal.

On systems where SELinux is enabled, sVirt isolates guests and the hypervisor. Each virtual machine process is labeled and is automatically allocated a unique level, and the associated virtual disk files are given matching labels.

Virtual Machine Types

Two main virtual machine types are available to install the guest operating system on. The earlier of the two uses the i440FX chip set, and provides ISA and PCI bridges, an IDE controller, and VGA and Ethernet adapters. The Q35 machine type is the later of the two, and should be used in most cases. It supports later virtual hardware interfaces such as PCIe and SATA, and includes an SM Bus controller.

In Red Hat Enterprise Linux 8 and later versions, UEFI and Secure Boot support for virtual machines is provided by Open Virtual Machine Firmware (OVMF), in the edk2-ovmf package.

Supported Guest Operating Systems

For virtualization solutions, Red Hat provides guest operating systems that are based on the product that you are using.

Red Hat offers KVM for using single-machine virtualization on RHEL. For more scalable and advanced features, Red Hat offers Red Hat OpenShift Virtualization and Red Hat OpenStack Platform.

For more information about supported guest operating systems for RHV, RHOSP, and OpenShift Virtualization, refer to Certified Guest Operating Systems in Red Hat OpenStack Platform, Red Hat Virtualization, OpenShift Virtualization and Red Hat Enterprise Linux with KVM

Configure a Red Hat Enterprise Linux Physical System as a Virtualization Host

Administrators can configure a Red Hat Enterprise Linux system as a virtualization host, as appropriate for development, testing, training, or when needing to work in multiple operating systems at the same time.

Install the Virtualization Tools

Install the Virtualization Host DNF package group to prepare a system to become a virtualization host.

[root@host ~]# dnf group list | grep -i virt
   Virtualization Host
[root@host ~]# dnf group info "Virtualization Host"
...output omitted...
Environment Group: Virtualization Host
 Description: Minimal virtualization host.
 Mandatory Groups:
   Base
   Core
   Standard
   Virtualization Hypervisor
   Virtualization Tools
 Optional Groups:
   Debugging Tools
   Network File System Client
   Remote Management for Linux
   Virtualization Platform

[root@host ~]# dnf group install "Virtualization Host"
...output omitted...

Verify the System Requirements for Virtualization

KVM requires either an Intel processor with the Intel VT-x and Intel 64 extensions for x86-based systems, or an AMD processor with the AMD-V and the AMD64 extensions. To verify your hardware and the system requirements, use the virt-host-validate command.

[root@host ~]# virt-host-validate
  QEMU: Checking for hardware virtualization                            : PASS
  QEMU: Checking if device /dev/kvm exists                              : PASS
  QEMU: Checking if device /dev/kvm is accessible                       : PASS
  QEMU: Checking if device /dev/vhost-net exists                        : PASS
  QEMU: Checking if device /dev/net/tun exists                          : PASS
  QEMU: Checking for cgroup 'cpu' controller support                    : PASS
  QEMU: Checking for cgroup 'cpuacct' controller support                : PASS
  QEMU: Checking for cgroup 'cpuset' controller support                 : PASS
  QEMU: Checking for cgroup 'memory' controller support                 : PASS
  QEMU: Checking for cgroup 'devices' controller support                : PASS
  QEMU: Checking for cgroup 'blkio' controller support                  : PASS
  QEMU: Checking for device assignment IOMMU support                    : PASS
  QEMU: Checking for secure guest support                               : PASS

The system must pass all the validation items to operate as a KVM host.

Install a Virtual Machine from the Command Line

Install the virt-install package, and then use the virt-install command to deploy a virtual machine from the command line. Many installation sources are supported, such as ISO, NFS, HTTP, and FTP. The following example uses the virt-install command's --cdrom option to install the guest from an ISO image.

[root@host ~]# virt-install --name demo --memory 4096 --vcpus 2 --disk size=40 \
--os-type linux --cdrom /root/rhel.iso
...output omitted...

Manage Virtual Machines with the Web Console

The libvirt-client package provides the virsh command, to manage virtual machines from the command line. Alternatively, you can create and manage virtual machines graphically by using the web console Virtual Machines plug-in.

Install the cockpit-machines package to add the Virtual Machines menu to the web console.

[root@host ~]# dnf install cockpit-machines

If the web console is not already running, then start and enable it.

[root@host ~]# systemctl enable --now cockpit.socket

In a web browser that is running on the local machine, navigate to https://localhost/9090 and log in to the web console. Switch to administrative mode and enter your password, if necessary.

Figure 12.5: Managing virtual machines in the web console

To create a virtual machine with the web console, access the Virtual Machines menu. From there, click Create VM and enter the VM configuration in the Create New Virtual Machine window. If you are using the web console for the first time after installing the Virtual Machines plug-in, then you must reboot your system to start the libvirt virtualization.

Figure 12.6: Creating a virtual machine in the web console
  • Name sets a domain name for the virtual machine configuration. This name is unrelated to the hostname that you give the virtual machine during installation.

  • Installation type is the method for accessing the installation media. Choices include the local file system, or an HTTPS, FTP, or NFS URL, or PXE.

  • Installation source provides the path to the installation source.

  • Operating system defines the virtual machine's operating system. The virtualization layer presents hardware emulation to be compatible with the chosen operating system.

  • Storage defines whether to create a storage volume or to use an existing one.

  • Size is the disk size when creating a new volume. Associate additional disks with the VM after installation.

  • Memory is the amount of RAM to provide to the new VM.

  • Immediately start VM indicates whether the VM immediately starts after you click Create.

Click Create to create the VM, and click Install to start the operating system installation. The web console displays the VM console from which you can install the system.

Revision: rh134-9.3-5fd2368