Create Windows virtual machines

To create a virtual machine (VM) with a Windows guest operating system on a RHEL 10 host, you use the virt-install command or the RHEL 10 web console.

Before you begin

  • 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
  • A storage medium with the KVM virtio drivers.

    To create this medium, see Preparing virtio driver installation media on a host machine.

  • If you are installing Windows 11, the edk2-ovmf, swtpm and libtpms packages must be installed on the host.

Procedure

  1. Create the VM. For instructions, see Creating virtual machines, but be aware of the following specifics.
    • If you are using the virt-install utility to create the VM, add the following options to the command:
      • The storage medium with the KVM virtio drivers. For example:
        --disk path=/usr/share/virtio-win/virtio-win.iso,device=cdrom
      • The Windows version that you want to install. For example, for Windows 10 and 11:
        --os-variant win10

        For a list of available Windows versions and the appropriate option, use the following command:

        # osinfo-query os
      • If 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 Create and run.
      • If you are installing Windows 11, or you want to use additional Windows Server 2022 features, confirm by clicking Create and edit and enable UEFI and vTPM using the CLI:
        1. Open the XML configuration of the VM:
          # virsh edit windows-vm
        2. Add the firmware='efi' option to the os element:
          <os firmware='efi'>
            <type arch='x86_64' machine='pc-q35-6.2'>hvm</type>
            <boot dev='hd'/>
          </os>
        3. Add the tpm device inside the devices element:
          <devices>
            <tpm model='tpm-crb'>
              <backend type='emulator' version='2.0'/>
            </tpm>
          </devices>
        4. Start the Windows installation by clicking Install in the Virtual machines table.
  2. Install the Windows OS in the VM.

    For information about how to install a Windows operating system, see the relevant Microsoft installation documentation.

  3. 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.
  4. Configure KVM virtio drivers in the Windows guest OS. For details, see Installing KVM paravirtualized drivers for Windows virtual machines.
  5. Optional: Optimize the performance of the Windows VM. For details, see Optimizing Windows virtual machines.