Chapter 2. Preparing RHEL to host virtual machines
To use virtualization in RHEL 10, you must install virtualization packages and ensure your system is configured to host virtual machines (VMs). The specific steps to do this vary based on your CPU architecture.
2.1. Preparing an AMD64 or Intel 64 system to host virtual machines Copy linkLink copied to clipboard!
Before creating virtual machines (VMs) on an AMD64 or Intel 64 system running RHEL 10, you must first set up a KVM hypervisor on the system.
Prerequisites
- Red Hat Enterprise Linux 10 is installed and registered on your host machine. For instructions, see the RHEL installation guide.
The following minimum system resources are available:
- 6 GB free disk space for the host, plus another 6 GB for each intended VM.
- 2 GB of RAM for the host, plus another 2 GB for each intended VM.
Procedure
Install the virtualization hypervisor packages.
# dnf install qemu-kvm libvirt virt-install virt-viewer
Start the virtualization services:
# for drv in qemu network nodedev nwfilter secret storage interface; do systemctl start virt${drv}d{,-ro,-admin}.socket; done
Verification
Verify that your system is prepared to be a virtualization host:
# virt-host-validateExample output:
QEMU: Checking for device assignment IOMMU support : PASS QEMU: Checking if IOMMU is enabled by kernel : WARN (IOMMU appears to be disabled in kernel. Add intel_iommu=on to kernel cmdline arguments) LXC: Checking for Linux >= 2.6.26 : PASS [...] LXC: Checking for cgroup 'blkio' controller mount-point : PASS LXC: Checking if device /sys/fs/fuse/connections exists : FAIL (Load the 'fuse' module to enable /proc/ overrides)If all virt-host-validate checks return a
PASSvalue, your system is prepared for creating VMs.If any of the checks return a
FAILvalue, follow the displayed instructions to fix the problem.If any of the checks return a
WARNvalue, consider following the displayed instructions to improve virtualization capabilities.
Troubleshooting
If KVM virtualization is not supported by your host CPU, virt-host-validate generates the following output:
QEMU: Checking for hardware virtualization: FAIL (Only emulated CPUs are available, performance will be significantly limited)However, VMs on such a host system will fail to boot, rather than have performance problems.
To work around this, you can change the
<domain type>value in the XML configuration of the VM toqemu. Note, however, that Red Hat does not support VMs that use theqemudomain type, and setting this is highly discouraged in production environments.
2.2. Preparing an IBM Z system to host virtual machines Copy linkLink copied to clipboard!
Before creating virtual machines (VMs) on an IBM Z system running RHEL 10, you must first set up a KVM hypervisor on the system.
Prerequisites
- Red Hat Enterprise Linux 10 is installed and registered on your host machine. For instructions, see the RHEL installation guide.
The following minimum system resources are available:
- 6 GB free disk space for the host, plus another 6 GB for each intended VM.
- 2 GB of RAM for the host, plus another 2 GB for each intended VM.
- 4 CPUs on the host. VMs can generally run with a single assigned vCPU, but Red Hat recommends assigning 2 or more vCPUs per VM to avoid VMs becoming unresponsive during high load.
- Your IBM Z host system is using an IBM z14 CPU or later.
RHEL 10 is installed on a logical partition (LPAR). In addition, the LPAR supports the start-interpretive execution (SIE) virtualization functions.
To verify this, search for
siein your/proc/cpuinfofile.# grep sie /proc/cpuinfo features : esan3 zarch stfle msa ldisp eimm dfp edat etf3eh highgprs te sie
Procedure
Install the virtualization packages:
# dnf install qemu-kvm libvirt virt-installStart the virtualization services:
# for drv in qemu network nodedev nwfilter secret storage interface; do systemctl start virt${drv}d{,-ro,-admin}.socket; done
Verification
Verify that your system is prepared to be a virtualization host.
# virt-host-validate [...] 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 'memory' controller support : PASS QEMU: Checking for cgroup 'memory' controller mount-point : PASS [...]If all virt-host-validate checks return a
PASSvalue, your system is prepared for creating VMs.If any of the checks return a
FAILvalue, follow the displayed instructions to fix the problem.If any of the checks return a
WARNvalue, consider following the displayed instructions to improve virtualization capabilities.
Troubleshooting
If KVM virtualization is not supported by your host CPU, virt-host-validate generates the following output:
QEMU: Checking for hardware virtualization: FAIL (Only emulated CPUs are available, performance will be significantly limited)However, VMs on such a host system will fail to boot, rather than have performance problems.
To work around this, you can change the
<domain type>value in the XML configuration of the VM toqemu. Note, however, that Red Hat does not support VMs that use theqemudomain type, and setting this is highly discouraged in production environments.
2.3. Preparing an ARM 64 system to host virtual machines Copy linkLink copied to clipboard!
Before creating virtual machines (VMs) on a 64-bit system (also known as ARM 64 or AArch64) running RHEL 10, you must first set up a KVM hypervisor on the system.
Prerequisites
- Red Hat Enterprise Linux 10 is installed and registered on your host machine. For instructions, see the RHEL installation guide.
The following minimum system resources are available:
- 6 GB free disk space for the host, plus another 6 GB for each intended guest.
- 4 GB of RAM for the host, plus another 4 GB for each intended guest.
Procedure
Install the virtualization packages:
# dnf install qemu-kvm libvirt virt-installStart the virtualization services:
# for drv in qemu network nodedev nwfilter secret storage interface; do systemctl start virt${drv}d{,-ro,-admin}.socket; done
Verification
Verify that your system is prepared to be a virtualization host. Run the following command as root:
# virt-host-validate [...] QEMU: Checking if device /dev/vhost-net exists : PASS QEMU: Checking if device /dev/net/tun exists : PASS QEMU: Checking for cgroup 'memory' controller support : PASS QEMU: Checking for cgroup 'memory' controller mount-point : PASS [...] QEMU: Checking for cgroup 'blkio' controller support : PASS QEMU: Checking for cgroup 'blkio' controller mount-point : PASS QEMU: Checking if IOMMU is enabled by kernel : PASSIf all virt-host-validate checks return a
PASSvalue, your system is prepared for creating virtual machines.If any of the checks return a
FAILvalue, follow the displayed instructions to fix the problem.If any of the checks return a
WARNvalue, consider following the displayed instructions to improve virtualization capabilities.
2.4. Setting up the web console to manage virtual machines Copy linkLink copied to clipboard!
Before using the RHEL 10 web console to manage virtual machines (VMs), you must install the web console virtual machine plugin on the host.
Prerequisites
You have installed the RHEL 10 web console.
For instructions, see Installing and enabling the web console.
Procedure
Install the
cockpit-machinesplugin.# dnf install cockpit-machines
Verification
- Log in to the RHEL 10 web console.
If the installation was successful, appears in the web console side menu.
2.5. Setting up easier access to remote virtualization hosts Copy linkLink copied to clipboard!
When managing virtual machines (VMs) on a remote host system by using libvirt utilities on the command line, you can optimize the process of connecting to the remote host.
By default, to connect to a VM on a remote host, you must use the -c qemu+ssh://root@hostname/system syntax. For example, to use the virsh list command as root on the 192.0.2.1 host:
# virsh -c qemu+ssh://root@192.0.2.1/system list
Example output:
root@192.0.2.1's password:
Id Name State
---------------------------------
1 remote-guest running
However, you can remove the need to specify the connection details in full by modifying your SSH and libvirt configuration. For example:
# virsh -c remote-host list
Example output:
root@192.0.2.1's password:
Id Name State
---------------------------------
1 remote-guest running
To enable this improvement, use the following instructions.
Prerequisites
- Virtualization is enabled on your host system. For instructions, see Preparing RHEL to host virtual machines.
Procedure
Edit the
~/.ssh/configfile on your local host and add an entry similar to the following:Host <host-alias> User root Hostname 192.0.2.1In this example, <host-alias> is a shortened name associated with the
root@192.0.2.1remote host connection.Edit the
/etc/libvirt/libvirt.conffile and add lines similar to the following:uri_aliases = [ "<qemu-alias>=qemu+ssh://<host-alias>/system", ]In this example, <qemu-alias> is a host alias that QEMU and
libvirtutilities will use for theqemu+ssh://192.0.2.1/systemconnection.Optional: If you want to use
libvirtutilities exclusively on a single remote host, you can also set a specific connection as the default target forlibvirt-based utilities.Edit the
/etc/libvirt/libvirt.conffile and set the value of theuri_defaultparameter to <qemu-alias> as a defaultlibvirttarget.# These can be used in cases when no URI is supplied by the application # (@uri_default also prevents probing of the hypervisor driver). # uri_default = "<qemu-alias>"WarningYou cannot do this if you also want to manage VMs on your local host or on different remote hosts.
Optional: To avoid having to provide the root password when connecting to a remote host, use one or more of the following methods:
- Set up key-based SSH access to the remote host
- Use SSH connection multiplexing to connect to the remote system
- Kerberos authentication in Identity Management
Verification
Confirm that you can manage remote VMs by using
libvirt-based utilities on the local system with an added-c <qemu-alias>parameter. This automatically performs the commands over SSH on the remote host.For example, verify that the following lists VMs on the 192.0.2.1 remote host, the connection to which was set up as <qemu-alias> in the previous steps:
# virsh -c <qemu-alias> listSuccessful output:
root@192.0.2.1's password: Id Name State ---------------------------------------- 1 example-remote-guest runningIf you have set up the default URI to a remote host, ensure that
libvirtcommands automatically apply to the specified remote host.$ virsh listSuccessful output:
root@192.0.2.1's password: Id Name State --------------------------------- 1 example-remote-guest running