The following steps can be used to get Windows 11 installed in a KVM virtual machine. For the host OS I am using Ubuntu. I will be using Virtual Machine Manager to create and manage the VM.
The basic requirements need to be installed. These are:
For ubuntu the required packages can be installed from the default repositories with this command:
sudo apt -y install \
qemu-kvm qemu-system bridge-utils virt-manager libosinfo-bin ovmf
For the software tpm package (swtpm
), it will require an additional PPA to be added. The author has a different PPA for each Ubuntu release; add the relevant PPA for the Ubuntu release running. Since I am running Ubuntu Impish (a non-LTS release) there is no repository specific to this release available, instead I need to use the Focal release:
sudo add-apt-repository ppa:stefanberger/swtpm-focal
In my case I got a 404 because the package source gets added using Impish as the release name:
Err:35 http://ppa.launchpad.net/stefanberger/swtpm/ubuntu impish Release
404 Not Found [IP: 2001:67c:1560:8008::19 80]
To fix it, I needed to edit the file /etc/apt/sources.list.d/stefanberger-ubuntu-swtpm-$(lsb_release -c -s).list
and change the release to focal
. The content should look like this:
deb http://ppa.launchpad.net/stefanberger/swtpm-focal/ubuntu/ focal main
# deb-src http://ppa.launchpad.net/stefanberger/swtpm-focal/ubuntu/ focal main
The apt source can then be updated and the swtpm package installed:
sudo apt update
sudo apt -y install swtpm swtpm-tools
As an optional step, to give your standard user account access to manage the VM add it to the libvirt
group:
sudo usermod -aG libvirt $USER
The group modification will require you to log out and log in again or reboot.
If you do not do this you will need to run Virtual Machine Manager using sudo:
sudo virt-manager
The two ISO's needed (Windows and virtio drivers) can be moved to the default images storage location (/var/lib/libvirt/images
).
The default virtual network may not be started. If you will be using the default virtual network (which provides NAT for the VM), check this from the details menu by right clicking on "QEMU/KVM":
Select the Virtual Networks tab and then the default network on the left. The "State" should be "Active", if not click the Play icon at the bottom left:
Select the create option. The "Local install media" option should be selected and the architecture should be x86_64:
Browse and select the ISO for the installation media. The automatically detect OS should be disabled and the OS selection should be set to Windows 10 (there is currently no Windows 11 option at the time of writing):
Select the amount of RAM and CPU to allocate to the VM. I will be allocating 5GB of RAM with 4 CPU's:
Select the amount of disk space to allocate to the VM. The VM must have at least 52GB of storage; I will be allocating 60GB:
On the confirmation screen select the "Customize configuration before install" option; there is some hardware changes that must be made before the OS can be installed. Also check that the correct virtual network is selected:
The following hardware configuration options must be set for the OS to work. After each change made below you will need to click the bottom right "Apply" button.
The chipset and firmware should be changed from the default to get UEFI working:
The SATA disk will be changed to a VirtIO device instead for performance:
The virtual NIC should also be a VirtIO device:
Click add hardware at the bottom left, select graphics and then the VNC server type:
The VirtIO driver CD needs to be added so the storage driver can be loaded during the installation. After the installation is complete it can then also be used to load the remaining drivers (NIC, display, QEMU guest utilities etc.).
Click add hardware at the bottom left, select storage and then set the Device type to CDROM device. Select the VirtIO driver ISO from the custom storage option:
The TPM needs to be added. Select add hardware at the bottom left, select TPM and set the following options:
The Begin Installation option at the top left can now be selected:
The VM should then be created. Start the Windows installation as normal.
On the storage selection screen you will get the message "We couldn't find any drives. To get a storage driver, click Load Driver.":
Select the "Load Driver" option and then click "Browse":
Browse the VirtIO driver CD and select the "w11" directory inside "amd64":
It should then show the "Red Hat VirtIO SCSI controller" driver; click Next:
The installation should be able to then proceed.