Posted: . At: 9:55 AM. This was 6 years ago. Post ID: 12015
Page permalink. WordPress uses cookies, or tiny pieces of information stored on your computer, to verify who you are. There are cookies for logged in users and for commenters.
These cookies expire two weeks after they are set.


Run Windows in a qemu virtual machine easily for testing purposes. This is lots of fun to do.


Running Windows in a qemu virtual machine is very easy.

Install all required qemu packages.

jason@Yog-Sothoth:~$ sudo apt-get install qemu-kvm qemu-utils qemu

Now we can create a virtual machine disk image to install our virtual machine onto.

jason@Yog-Sothoth:~$ qemu-img create -f raw win7.img 30G

Some drivers are required, as Windows will not support the disk type that qemu uses. Download this ISO image and load it to provide the drivers needed for installation.

https://fedorapeople.org/groups/virt/virtio-win/deprecated-isos/stable/virtio-win-0.1-81.iso.

Select the “Load Driver” option.

Select "Load Driver" here.
Select “Load Driver” here.

Then select the proper SCSI driver here to allow Windows 7 to see the HDD.

Select the SCSI driver to enable the HDD to be detected by Windows.
Select the SCSI driver to enable the HDD to be detected by Windows.

And of course, a Windows ISO is required. I used Windows 7.

This is the updated script to run the whole virtual machine.

#!/bin/sh
 
export QEMU_AUDIO_DRV=alsa
DISKIMG=~/win7.img
WIN7IMG=~/Downloads/win7.iso
VIRTIMG=~/Downloads/virtio-win-0.1-81.iso
qemu-system-x86_64 --enable-kvm -drive file=${DISKIMG},if=virtio -m 4096 \
-net nic,model=virtio -net user -cdrom ${WIN7IMG} \
-drive file=${VIRTIMG},index=3,media=cdrom \
-rtc base=localtime,clock=host -smp cores=4,threads=4 \
-usbdevice tablet -soundhw ac97 -cpu host -vga vmware

When the installation gets to the disk selection stage, you will need to add a driver, then select the SCSI driver to enable Windows 7 to detect the disk to install to. After that it will work perfectly. Once installation has completed, and you have re-booted go to device manager and install drivers for the Ethernet adapter, these are on the same drive as the disk drivers. Then networking will work perfectly.

This is how easy it is to get Windows installed in a simple and fast VM on a Linux machine. This is very good for testing various things and running Windows software.


Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.