Installation of Windows operating systems on a KVM hypervisor is a common requirement in varying environments. While the process is straightforward, it can involve some nuances to ensure perfomance optimization and ensure smooth operation.
You can create a fully-virtualized Windows machine on a KVM host, launch the graphical Windows installer inside the virtual machine (VM), and optimize the installed Windows guest operating system (OS). In this section of the book we provide a comprehensive guide with tips and tricks to get the most out of your Windows installation on KVM. However, there are few prerequisites for this setup.
- Windows Desktop
Visit the official Microsoft website and download Windows ISO. See direct links below:
- VirtIO Drivers
VirtIO drivers helps to optimize the performance and compatibility of Windows VMs running on KVM. These drivers are designed to bridge the gap between the emulated hardware of the virtual machine and the host system, enabling faster and more efficient communication.
- Improved network performance
- Improved disk performance
- Enhanced display performance
- Efficiency in memory management
- Low CPU overhead
The VirtIO drivers are not included natively in Windows, which is why the VirtIO drivers ISO must be mounted during installation to load the necessary drivers. After installation, it is essential to install all available VirtIO drivers to maximize performance and functionality.
Mastering KVM Virtualization - The Ultimate eBook
From home labs to production clouds - master KVM Host management, automating KVM administration using Terraform, Vagrant, and cloud automation. This eBook will enable you to build scalable virtual infrastructure that works whether you're learning at home or deploying enterprise solutions. Get your full copy today
Download the VirtIO drivers ISO from the Fedora Project. It’s recommended to get the latest available version. If you prefer to use the CLI downloaders like wget you can use the following commands:
- Downloading latest release (recommended)
wget https://fedorapeople.org/groups/virt/virtio-win/direct-downloads/latest-virtio/virtio-win.iso
- Dowloading stable release:
wget https://fedorapeople.org/groups/virt/virtio-win/direct-downloads/stable-virtio/virtio-win.iso
Copy the VirtIO drivers ISO to default KVM storage pool.
sudo mv virtio-win.iso /var/lib/libvirt/images
Install Windows 11
To install Windows 11, the edk2-ovmf
, swtpm
and libtpms
packages must be installed on the KVM host.
- Installations on Debian / Ubuntu
sudo apt update
sudo apt -y install ovmf swtpm swtpm-tools
- Installations on RHEL based systems – Rocky / AlmaLinux / CentOS Stream, e.t.c.
sudo dnf -y install edk2-ovmf swtpm swtpm-tools
Download Windows 11 ISO installation image from Microsoft Downloads page and move the file to the KVM default storage pool path to avoid permission issues.
sudo virt-install \
--name win11 \
--ram 8192 \
--vcpus 2 \
--cpu host-passthrough \
--os-variant win11 \
--disk path=/var/lib/libvirt/images/win11.qcow2,size=70,bus=virtio,format=qcow2 \
--cdrom /var/lib/libvirt/images/win11.iso \
--disk path=/var/lib/libvirt/images/virtio-win.iso,device=cdrom \
--network network=default,model=virtio \
--graphics vnc \
--video virtio \
--features kvm_hidden=on,smm=on \
--tpm backend.type=emulator,backend.version=2.0,model=tpm-tis \
--boot loader=/usr/share/OVMF/OVMF_CODE_4M.secboot.fd,loader_ro=yes,loader_type=pflash,nvram_template=/usr/share/OVMF/OVMF_VARS_4M.fd
For RHEL based systems, replace boot loader configuration like below:
--boot loader=/usr/share/edk2/ovmf/OVMF_CODE.secboot.fd,loader_ro=yes,loader_type=pflash,nvram_template=/usr/share/edk2/ovmf/OVMF_VARS.secboot.fd
Refer to the Windows server installation example for the explanation of the virt-install
command options used. Below is the summary of the extra options used:
--cpu host-passthrough
– Directly passes host CPU features to the VM for improved performance and compatibility.--os-variant win11
– Specifies the OS variant as Windows 11 to optimize the VM configuration.--graphics vnc
– Enables VNC for remote graphical access to the VM. To set VNC password use something like--graphics vnc,listen=0.0.0.0,password=PassW0rd
where PassW0rd is the vnc password configured.--video virtio
– Uses VirtIO for improved graphical performance.--features kvm_hidden=on,smm=on
:- kvm_hidden=on: Hides the hypervisor from the guest OS.
- smm=on: Enables System Management Mode for secure boot.
--tpm backend.type=emulator,backend.version=2.0,model=tpm-tis
:- backend.type=emulator: Uses an emulated TPM.
- backend.version=2.0: Configures TPM 2.0, required for Windows 11.
- model=tpm-tis: Sets the TPM model.
--boot loader=/usr/share/OVMF/OVMF_CODE_4M.secboot.fd,loader_ro=yes,loader_type=pflash,nvram_template=/usr/share/OVMF/OVMF_VARS_4M.fd
:- loader: Specifies UEFI firmware with secure boot support.
- loader_ro=yes: Makes the loader read-only.
- loader_type=pflash: Uses flash memory for UEFI.
- nvram_template: Points to the NVRAM template for boot variables.
In the boot screen select language and time/currency format to begin installation of Windows 11 on KVM.

Choose the windows operating system install to install.

We need to load two drivers from virtio iso image attached.
- Installing VirtIO SCSI Controller driver
To resolve “No drives were found.” during windows installation on KVM we need to load the VirtIO SCSI Driver.

Click “Load driver” to manually provide the VirtIO SCSI driver. In the next screen click “Browse“.

Open the CD-ROM labeled “virtio-win“. The go to the “amd64” folder and corresponding folder to your Windows version, example is “win11” for Windows 11.

Click “OK” to load the driver.

Select the driver loaded and click “Install” button.

The VirtIO SCSI disk should now appear in the list of drives.

- Load VirtIO Ethenet driver
Open the CD-ROM labeled “virtio-win“. Navigate to “NetKVM” > “win11” (for windows 11) > “amd64” or “arm64” depending on your host cpu type. Click “OK” once selected.

Click on the loaded driver name in the description and hit “Install” button. Once everything is okay proceed with the installationof Windows 11 on KVM hypervisor.

Install QEMU Guest Agent and VirtIO Drivers on Windows guest
To allow KVM host to perform a certain subset of operations on a Windows virtual machine (VM), you need to 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. This is the .iso
file that we downloaded earlier on during Windows server / windows desktop installation using virt-install
commands.
Ensure the .iso file provided by the virtio-win package is attached as a storage device to the Windows VM. Then in the In the Windows guest operating system, open the File Explorer application.
Click This PC
. In the Devices and drives
pane, open the virtio-win
medium.

1 – Install QEMU Guest Agent
Run the virtio-guest-tools
installer to setup the QEMU Guest Agent in your Windows Desktop or Windows Server with GUI virtual machine.

Click ‘Install‘.

2 – Install KVM virtio drivers
Also consider installing KVM virtio drivers
for your operating system. Based on the operating system installed on the VM, run one of the installers:
- If using a 32-bit operating system, run the
virtio-win-gt-x86.msi
installer. - If using a 64-bit operating system, run the
virtio-win-gt-x64.msi
installer.

In the installer setup wizard that opens, follow the displayed instructions to complete the driver installation.

After the installation completes, reboot the VM to complete the driver installations.
Verification
- On your Windows VM, navigate to the Device Manager:
- Click Start
- Search for Device Manager
- Ensure that the devices are using the correct drivers:
- Click a device to open the Driver Properties window.
- Navigate to the Driver tab.
- Click Driver Details.
🌍 Our KVM eBook covers all this in details and more. In the book you will learn:
- Understanding Virt-install
- Linux VM Installation from ISO image
- Linux VM Installation using Cloud-Init
- Windows installation (Desktop and Server) using virt-install
- VMs Installation using Virt-builder
- VMs Install using PXE Boot and virt-install
- VMs Installation using virt-install and kickstart
- GPU Passthrough to Virtual Machines