Ce contenu n'est pas disponible dans la langue sélectionnée.
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).
2.1. Preparing an AMD64 or Intel 64 system to host virtual machines Copier lienLien copié sur presse-papiers!
To set up a KVM hypervisor and create virtual machines (VMs) on an AMD64 or Intel 64 system running RHEL 10, start the necessary services.
Prerequisites
- Red Hat Enterprise Linux 10 is installed and registered on your host machine.
Your system meets the following hardware requirements to work as a virtualization host:
- The architecture of your host machine supports KVM virtualization.
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
# dnf install qemu-kvm libvirt virt-install virt-viewer
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Start the virtualization services:
for drv in qemu network nodedev nwfilter secret storage interface; do systemctl start virt${drv}d{,-ro,-admin}.socket; done
# for drv in qemu network nodedev nwfilter secret storage interface; do systemctl start virt${drv}d{,-ro,-admin}.socket; done
Copy to Clipboard Copied! Toggle word wrap Toggle overflow
Verification
Verify that your system is prepared to be a virtualization host:
Copy to Clipboard Copied! Toggle word wrap Toggle overflow If all virt-host-validate checks return a
PASS
value, your system is prepared for creating VMs.If any of the checks return a
FAIL
value, follow the displayed instructions to fix the problem.If any of the checks return a
WARN
value, 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)
QEMU: Checking for hardware virtualization: FAIL (Only emulated CPUs are available, performance will be significantly limited)
Copy to Clipboard Copied! Toggle word wrap Toggle overflow 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 theqemu
domain type, and setting this is highly discouraged in production environments.
2.2. Enabling QEMU Guest Agent features on your virtual machines Copier lienLien copié sur presse-papiers!
To use certain features on a virtual machine (VM) hosted on your RHEL 10 system, you must first configure the VM to use the QEMU Guest Agent (GA).
For a complete list of these features, see Virtualization features that require QEMU Guest Agent.
2.2.1. Enabling QEMU Guest Agent on Windows guests Copier lienLien copié sur presse-papiers!
To allow a RHEL host to perform a certain subset of operations on a Windows virtual machine (VM), you must enable the QEMU Guest Agent (GA). To do so, add a storage device that contains the QEMU Guest Agent installer to an existing VM or when creating a new VM, and install the drivers on the Windows guest operating system.
To install the Guest Agent (GA) by using the graphical interface, see the procedure below. To install the GA on a command line, use the Microsoft Windows Installer (MSI).
Prerequisites
- An installation medium with the Guest Agent is attached to the VM. For instructions on preparing the medium, see Preparing virtio driver installation media on a host machine.
Procedure
-
In the Windows guest operating system, open the
File Explorer
application. -
Click
This PC
. -
In the
Devices and drives
pane, open thevirtio-win
medium. -
Open the
guest-agent
folder. Based on the operating system installed on the VM, run one of the following installers:
-
If using a 32-bit operating system, run the
qemu-ga-i386.msi
installer. -
If using a 64-bit operating system, run the
qemu-ga-x86_64.msi
installer.
-
If using a 32-bit operating system, run the
Optional: If you want to use the para-virtualized serial driver (
virtio-serial
) as the communication interface between the host and the Windows guest, verify that thevirtio-serial
driver is installed on the Windows guest.For more information about installing
virtio
drivers, see: Installing virtio drivers on a Windows guest.
Verification
On your Windows VM, navigate to the Services window.
Computer Management > Services
-
Ensure that the status of the
QEMU Guest Agent
service isRunning
.
2.2.2. Virtualization features that require QEMU Guest Agent Copier lienLien copié sur presse-papiers!
If you enable QEMU Guest Agent (GA) on a virtual machine (VM), you can use the following commands on your host to manage the VM:
virsh shutdown --mode=agent
-
This shutdown method is more reliable than
virsh shutdown --mode=acpi
, becausevirsh shutdown
used with QEMU GA is guaranteed to shut down a cooperative guest in a clean state.
virsh domfsfreeze
andvirsh domfsthaw
- Freezes the guest file system in isolation.
virsh domfstrim
Instructs the guest to trim its file system, which helps to reduce the data that needs to be transferred during migrations.
ImportantIf you want to use this command to manage a Linux VM, you must also set the following SELinux boolean in the guest operating system:
setsebool virt_qemu_ga_read_nonsecurity_files on
# setsebool virt_qemu_ga_read_nonsecurity_files on
Copy to Clipboard Copied! Toggle word wrap Toggle overflow virsh domtime
- Queries or sets the guest’s clock.
virsh setvcpus --guest
- Instructs the guest to take CPUs offline, which is useful when CPUs cannot be hot-unplugged.
virsh domifaddr --source agent
- Queries the guest operating system’s IP address by using QEMU GA. For example, this is useful when the guest interface is directly attached to a host interface.
virsh domfsinfo
- Shows a list of mounted file systems in the running guest.
virsh set-user-password
- Sets the password for a given user account in the guest.
virsh set-user-sshkeys
Edits the authorized SSH keys file for a given user in the guest.
ImportantIf you want to use this command to manage a Linux VM, you must also set the following SELinux boolean in the guest operating system:
setsebool virt_qemu_ga_manage_ssh on
# setsebool virt_qemu_ga_manage_ssh on
Copy to Clipboard Copied! Toggle word wrap Toggle overflow
2.3. Setting up the web console to manage virtual machines Copier lienLien copié sur presse-papiers!
Before using the RHEL 10 web console to manage virtual machines (VMs), you must install the web console virtual machine plug-in 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-machines
plug-in.dnf install cockpit-machines
# dnf install cockpit-machines
Copy to Clipboard Copied! Toggle word wrap Toggle overflow
Verification
- Log in to the RHEL 10 web console.
If the installation was successful,
appears in the web console side menu.