Running Windows under Xen

This documentation was contributed by Scott Grayban ( sgrayban @ gmail.com ). They are specific to Debian, and may need modification for other Linux distributions :

1. Pre-Requisites for Installing a Windows Xen Guest

A XEN kernel must be installed and running at boot time.

Make sure you have HVM/VMX enabled in the bios - if you don't have this you can't run windows

In console type
`xm dmesg | grep VMX`

You should see...

*(XEN) HVM: VMX enabled*

If you don't you will need to restart the server and get into the BIOS and look for an option related to virtualization support.

If your BIOS does not have this you *can not* run any HVM guests, that means you can not run any version of Windows.

2. Turn off VNC for all xen linux guests and restart them.

3. Run `vi /etc/xen/scripts/qemu-ifup` and enter :


#!/bin/sh

echo -c 'config qemu network with xen bridge for '
echo $*

ifconfig $1 0.0.0.0 up
brctl addif eth0(your bridge) $1

4. Change to the xen directory for the rest of the steps with `cd /xen/`

Create blank 80GB disk image with :
`dd if=/dev/zero of=xenwin.img bs=1024k seek=81920 count=0`

`apt-get install libcdio-utils`

Get cd/dvd info and make sure its the right one
`cd-info /dev/(s|h)da`

Create the WindowsXP ISO
`dd if=/dev/(s|h)da of=Windows.iso`

5. Run `vi xenwin.cfg` and enter :


kernel = "/usr/lib/xen-default/boot/hvmloader"
builder = 'hvm'
vif = [ 'type=ioemu,bridge=eth0,ip=assigned-ip,mac=22:61:34:00:00:01' ] MAC address has to start with 22:61:34 or 00:16:3e
address = 'assigned-ip'
netmask = '255.255.255.XXX'
memory = 1024
shadow_memory = 8
name = "xenhvm" # domain prefix name
cdrom = 'file:/xen/Windows.iso' # name of iso image you created above
disk = [ 'file:/xen/xenwin.img,hdc,w', 'file:/xen/Windows.iso,hdb:cdrom,r' ]
device_model = '/usr/lib/xen-default/bin/qemu-dm'

# boot on floppy (a), hard disk (c) or CD-ROM (d)
# default: hard disk, cd-rom, floppy
#### boot must be dc to install windows after that you change it to c or cd
boot = "dc"
#boot = "c"

vnc = 1 # use VNC to insall and setup windows after that is done you can disable this
vncconsole = 0
vncpasswd = 'password'
vncviewer = 1
vncunused = 1
vnclisten = 'Domain-0 IP'
vcpus = 2 # number of cpu's to assign
stdvga = 0
serial = 'pty'
usbdevice = 'tablet' # Required for USB mouse
on_reboot = 'restart'
on_crash = 'restart'

6. Run the next 2 commands at the console

`xm create xenwin.cfg`

`brctl show`

Make sure that the tapX interface is assign to ethX you set in bridge= vif setting

7. Type the next command at the console :

`vncviewer assigned-ip`

and continue with the windows install and setup

8. Setup your windows networking using the correct IP/mask/gateway/dns
Setup remote desktop access if you need/want it

9. Turn VNC off in the xenwin.cfg file by setting `vnc = 0`

This step has to be done because XEN/qemu-dm will force the port to be 5900 and it will interfere with the other xen linux vnc guests.

10. Re-enable vnc for the xen linux guests if you turned them off in Step 2 and restart the guests.

11. Import the windows instance into Cloudmin at *Add System* -> *Add Xen instance*

12. You're done.

You should be able to access the windows server via RDP(remote desktop) as Administrator and start/stop/reboot and manage the windows guest as a normal windows server.

That means you can run the updates or install any windows apps that you might need.

Note - The default passwords for Administrator and new user is temp1234 if you are using the paid version of my WindowsXP img file that is fully functional and ready to use.

YOU MUST HAVE already bought WindowsXP and have a valid license to get the XEN img file, at order time you will have to electronically sign that agreement. Cloudmin might offer a free Windows ISO at some point.

For information above pricing of Xen Windows images, see http://www.borgnet.net/clients/knowledgebase/13/Debian-Lenny-WindowsXP-HVM-HOWTOorsetup.html