Installing Windows xp on a xen domU

Unfortunately, even super-cool elite web 2.0 startups such as where I work have to deal with shitty browsers such as the ones made by Microsoft. (Let’s be fair, however, 99% of software churned out by the bloated Microsoft machine is shitty, not just the browsers.)So… we have to test the browsers. But wait, where do we do it? Who on earth wants to dedicate real hardware to running such lesser-born bits? No one, is the answer, but we can sacrifice a bit of space on a Xen instance to make it happen. Hence this post: How do I install Windows XP on a Xen instance?

It’s not hard, really. In my case, I’m using logical volumes via LVM to host my xen instances, so that’s what my example will outline. I’m also installing from a Windows XP CD which came with a computer no longer running such a crappy operating system. This assumes you have already created a Xen dom0 and have available space in some sort of volume group which I will call your_vg_name.

Create a logical volume to house your windows xp instance:
$ lvcreate --size 5G --name winxp01 your_vg_name

Now, in your dom0, use something like the following for your “winxp.cfg”. In my case, I have configuration for browser testing machines for ie6 and ie7. So this is an example ie6 machine config in /etc/xen:
rwoodrum@xen1test:/etc/xen$ cat ie6-01.cfg
kernel = "/usr/lib/xen-default/boot/hvmloader"
builder = 'hvm'
memory = '768'
name = "ie6-01"
vcpus = 1
vif = [ 'type=ioemu, bridge=br-xen' ]
disk = [ 'phy:/dev/xen/winxp01,ioemu:hdc,w' ,'phy:/dev/hda,ioemu:hda:cdrom,r']
device_model = '/usr/lib/xen-default/bin/qemu-dm'
cdrom='/dev/hda'
ne2000=0
boot='c'
sdl=0
vnc=1
vncviewer=1

On a debian box, make sure you have the xen-ioemu package installed.

In this example, /dev/xen/winxp01 is my logical volume. /dev/hda points to my cdrom drive where the winxp disk will boot the installer. I had difficulties in specifying this as anything other than “hda”, so give it a shot, even if your cdrom is definitely not at /dev/hda.

Once the installer boots, you should be able to connect to the “console” with a vncviewer such as krdc at the address of your dom0. Note that if you are installing multiple instances requiring the vnc console, you may have to specify a specific display. e.g. instead of just vnc://10.1.1.1, you may have to say vnc://10.1.1.1:23 if your local display is “23″. This notation uses that of krdc to address vnc clients.

Once you work through the installer, you set up the instance like normal and give it an ip address. From then on, you can simply access it via a remote desktop client and use it/destroy it to hearts content. Works great for browser testing.

I wrote this up quite a bit of time after I actually did all of this, so I realize I may have described some steps in a non-intuitive fashion. Please don’t hesitate to comment for details!

Comments

Leave a Reply