Windows 10 guest virtual machine on linux mint 21 host using KVM and QEMU
Host OS: Linux mint 21 amd64
Guest OS: Windows 10 pro amd64 with "TPM 2.0" and "Secure Boot"
- Enable virtualization (e.g. VT-x / AMD-V) in your BIOS / UEFI settings.
- Download: https://www.microsoft.com/en-us/software-download/windows10ISO
- Download: https://fedorapeople.org/groups/virt/virtio-win/direct-downloads/stable-virtio/virtio-win.iso
- Install KVM dependencies
sudo apt-get update
sudo apt-get -y install qemu-kvm libvirt-clients libvirt-daemon-system bridge-utils virt-manager
sudo apt-get -y install qemu virt-viewer spice-vdagent
sudo apt-get -y install ovmf swtpm swtpm-tools
- Restart
- Open Virtual Machine Manager
- File > New virtual machine
- Local install media > Browse > Browse Local > Select downloaded windows ISO
- Pick RAM and CPU (can be changed later)
- Storage > Select or create custom storage > Manage >
+
- Name: anything
- Format: raw
- For best performance choose the raw format. The qcow2 format offers some advanced features such as copy on write and live snapshots (Source: proxmox)
- Capacity: At least 32GB
- Allocate entire volume now > checked (for max performance)
- Finish
- Choose volume
- Forward
- Give some name to the machine
- Customize configuration before install > Check
- Finish
- Add Hardware > Storage > Select or create custom storage
- Manage > Select downloaded virtio ISO > Choose volume
- Device type: CDROM device
- Bus type: default (SATA)
- Finish
- Overview:
- Chipset: Q35
- Firmware:
UEFI x86_64:/usr/share/OVMF/OVMF_CODE_4M.ms.fd
(ms stands for emulated microsoft secure boot) - Apply
- NIC
- Network source: NAT
- Device model: virtio
- Apply
- SATA Disk 1
- Disk bus: VirtIO
- Advanced options:
- Cache mode
- None: safety during power outage
- writeback: for max performance (details)
- Cache mode
- Apply
- Boot Options
- Check both CDROMs
- Apply
- Add Hardware
- TPM
- Type: Emulated (or passthrough)
- Advanced options > version > 2.0
- Finish
- TPM
- Begin Installation
- Install windows
- Start it, it might show a weird UEFI screen, type
exit
- Boot menu > pick boot from CD
- Install windows
- No HDD found?
- Load Driver > Browse > CD Drive (E:) > viostor > w10 > amd64 > Next
- Load Driver > Browse > CD Drive (E:) > NetKVM > w10 > amd64 > Next
- Load Driver > Browse > CD Drive (E:) > qxldod > w10 > amd64 > Next
- Next
- Start it, it might show a weird UEFI screen, type
- In windows Guest OS
- Open the virtio drivers CD
- Run virtio-win-guest-tools.exe
Bonus: Add and run a virtual machine using a command (does not work)
sudo virt-install \
--name Windows_10 \
--ram 6144 \
--disk path=/home/th/kvm/images/Windows_10.img,size=50 \
--cpu host-passthrough \
--vcpus=4 \
--os-variant=win10 \
--network bridge=br0 \
--graphics vnc,listen=0.0.0.0,password=password \
--video virtio \
--cdrom /home/th/Downloads/Win10_22H2_EnglishInternational_x64.iso \
--features kvm_hidden=on,smm=on \
--tpm backend.type=emulator,backend.version=2.0,model=tpm-tis \
--boot loader=/usr/share/OVMF/OVMF_CODE.secboot.fd,loader_ro=yes,loader_type=pflash,nvram_template=/usr/share/OVMF/OVMF_VARS.ms.fd
Sources:
- https://raphtlw.medium.com/how-to-set-up-a-kvm-qemu-windows-10-vm-ca1789411760
- https://www.smoothnet.org/qemu-tpm/
- https://lowendplay.com/kvm-no-installation-candidate/
- https://askubuntu.com/questions/1089753/e-package-libvirt-bin-has-no-installation-candidate
- https://help.ubuntu.com/community/KVM/Installation
- https://www.server-world.info/en/note?os=Ubuntu_22.04&p=kvm&f=12
- https://getlabsdone.com/how-to-enable-tpm-and-secure-boot-on-kvm/
- https://ostechnix.com/solved-cannot-access-storage-file-permission-denied-error-in-kvm-libvirt/
- https://wiki.archlinux.org/title/QEMU/Guest_graphics_acceleration