With the advent of hardware support for virtualisation in the Intel and AMD cpus it has been possible for a while now, to run windows OS as unmodified quest operating systems on top of Linux. This is supported by both the kernel virtual machine (kvm) and Xen solutions for virtualisation.
How to determine if your processor has the right hardware support for virtualisation
Unfortunately it is not possible to run windows with a processor that does not have this hardware support, with the kvm and xen solutions. You can install using a full virtual machine such as qemu though. You can check if your cpu has the appropriate hardware support via
"cat /proc/cpuinfo | grep -E 'vmx|vms'"
If any output shows then your processor has the necessary hardware support.
How to install windows using KVM
Using KVM it is relatively simple to install windows. Just complete the following steps:
Create a virtual hard disk. "qemu-img create -f qcow2 /home/mark/vms/windowsxp.img 4G" It appears that KVM only supports file based virtual hard-disk and cannot make use of a hardware or lvm partitions. This is a pity as lvm partitions are particularly useful for shrinking or increasing disk space. One bonus is that you can use vdkm as your file format. "qemu-img create -f vdmk ..." this is supposed to create vmware compatible files. I haven't tried the resulting file with vmware so I can't say if it works with vmware but it does work with KVM.
Once the virtual disk has been create one merely needs to go "kvm -hda /home/mark/vms/windowsxp.img -cdrom dev/cdrom -boot d -no-acpi" and you can start installing windows.
Once installed you just need to go "kvm -hda /home/mark/vms/windowsxp.img -no-acpi" to get your windows install to boot.
How to install windows using XEN
I haven't managed to get xen to work installing windows on my Ubuntu laptop. However the steps are given below. Maybe others will have better luck.
Create a virtual disk. You may use the process set out in step 1 above or use the "dd" command. "dd -if /dev/zero -of /home/mark/windowsxp.ing -bs 1M -count 6000" This will create an apporximate 6 gig disk for you. What I like about Xen is its ability to support physcial partitions as well as flat files for your virtual machine. I like to use LVM volumes with XEN so when more space is required its a simple matter to increase the size of the virtual disk without too much hassle.
You then need to create your config file for the domainU for XEN. The basic structure looks like:
name='windows-xp'
kernel='/usr/lib/xen-ioemu-3.0/boot/hvmloader'
builder='hvm'
vif = [ 'type=ioemu,bridge=xenbr0' ]
disk=[ 'file:/home/mark/vms/windos.img,ioemu:hda,w' ]
#disk = [ 'phy:/dev/Vol01,ioemu:hda,w' ] ==using a physcial volume. Works for paravirtualised xen domains. Not sure about hvm domains.
device_model='/usr/lib/xen-ioemu-3.0/bin/qemu-dm'
cdrom='/dev/cdrom'
nic=1
boot="d"
vnc =1
vncviewer = 1To run your Xen domain go 'xm create /etc/xen/windows/windows.cfg' and away you go. Once installed you will need to edit the config file and remove boot="d" so that the virtual machine will boot using the virtual image.
Hardware Virtual Machine (HVM) - Abstraction layer using Qemu.
Both kvm and XEN and intel/amd cpus can make use of qemu as the basis of their hardware virtual machine (HVM) so many of the command line options like default boot device are the same. This is a bonus for any system administrator.
The HVM is a virtualised platform with a virtual bios that allows the quest os to boot unmodified. In a paravirtualised setup this layer is not needed as the quest os is modified directly.
Common Errors - Exception 12 or Exception 13 - Not just for windows install
The exception 13 and exception 12 errors occur on the Intel processor only because of the way it virtualises real mode. What is weird, in my experiences, is that the same machine will give the error on some occasions and not on others. To get around this problem there are two options:
I usually use "-vnc 127.0.0.1:2" option with kvm. Exception 13 usually has to do with the video driver so by putting KVM into vnc mode the error doesn't occur. I then connect to the machine by going "vncviewer 127.0.0.1:1",
Use the "-no-kvm" option with kvm.
