3.3. Creating Windows virtual machines
You can create a fully-virtualized Windows machine on a RHEL 10 host, launch the graphical Windows installer inside the virtual machine (VM), and optimize the installed Windows guest operating system (OS).
To create the VM and to install the Windows guest OS, use the virt-install command or the RHEL 10 web console.
Prerequisites
A Windows OS installation source, which can be one of the following, and be available locally or on a network:
- An ISO image of an installation medium
- A disk image of an existing VM installation
A storage medium with the KVM
virtiodrivers.To create this medium, see Preparing virtio driver installation media on a host machine.
-
If you are installing Windows 11, the
edk2-ovmf,swtpmandlibtpmspackages must be installed on the host.
Procedure
Create the VM. For instructions, see Creating virtual machines, but be aware of the following specifics.
If you are using the
virt-installutility to create the VM, add the following options to the command:The storage medium with the KVM
virtiodrivers. For example:--disk path=/usr/share/virtio-win/virtio-win.iso,device=cdromThe Windows version you will install. For example, for Windows 10 and 11:
--os-variant win10For a list of available Windows versions and the appropriate option, use the following command:
# osinfo-query osIf you are installing Windows 11, enable Unified Extensible Firmware Interface (UEFI) and virtual Trusted Platform Module (vTPM):
--boot uefi
If using the web console to create the VM, specify your version of Windows in the Operating system field of the Create new virtual machine window.
- If you are installing earlier Windows versions than Windows 11 and Windows Server 2022, start the installation by clicking .
If you are installing Windows 11, or you want to use additional Windows Server 2022 features, confirm by clicking and enable UEFI and vTPM using the CLI:
Open the VM’s XML configuration:
# virsh edit windows-vmAdd the
firmware='efi'option to theoselement:<os firmware='efi'> <type arch='x86_64' machine='pc-q35-6.2'>hvm</type> <boot dev='hd'/> </os>Add the
tpmdevice inside thedeviceselement:<devices> <tpm model='tpm-crb'> <backend type='emulator' version='2.0'/> </tpm> </devices>- Start the Windows installation by clicking in the Virtual machines table.
Install the Windows OS in the VM.
For information about how to install a Windows operating system, refer to the relevant Microsoft installation documentation.
If you are using the web console to create the VM, attach the storage medium with virtio drivers to the VM by using the Disks interface.
For instructions, see Attaching existing disks to virtual machines by using the web console.
-
Configure KVM
virtiodrivers in the Windows guest OS. For details, see Installing KVM paravirtualized drivers for Windows virtual machines. - Optional: Optimize the performance of the Windows VM. For details, see Optimizing Windows virtual machines.