Running Windows under Qemu
I needed to make the cheapest door controller on Amazon work recently. I decided my best bet was to run a Windows virtual machine on an isolated network connected only to the door controller. The server available on site was fairly minimal and was not set up to host virtual machines. The script below just needs the qemu-system-x86_64
binary to be available and not a full VM system like virt-manager
or VirtualBox.
The solution I came up with was to install and run Windows in a qemu/KVM VM on the server with a VNC client running on my laptop.
There are a number of files to collect. Here are the download links. You should put them into one directory:
You’ll need a valid Windows license key for the installation.
Create a 30GB virtual hard disk image:
Run this script to begin the Windows installation. You will need to run vncviewer :1
once the VM is running:
During the installation, Windows will not be able to see the hard disk and you will need to have it look at the second CD-ROM containing the Qemu VirtIO drivers:
After installation, you can remove these lines and continue using the script without the install media:
To get networking going, you will need to install the VirtIO network drivers:
And you will probably want to install the QXL video adapter driver for better resolutions (include a line like -drive file=fat:rw:${IMAGE_DIR},format=raw
if networking is not working):
You can backup the VM right after installation by copying the qcow2 file and compressing it:
If you just want network access without the bridge, you can remove these lines:
And add:
Links:
- QEMU Documentation
- Gentoo - QEMU/Windows guest
- Funtoo.org - Windows 10 Virtualization with KVM
- Get Labs Done - Windows 10 on Ubuntu KVM
- Any IT Here? Help Me! - Howto do QEMU full virtualization with MacVTap networking
- Reddit - Guide to running Windows 7 in QEMU
- Matteo Croce on Medium - Windows as QEMU Guest
- Fedora Project - virtIO Drivers
- QXL-WDDM-DOD Driver Home