2009-05-03 - Updated guide for Ubuntu 9.04, Virtualbox 2.2 and IE8 final.
2010-04-08 - Update - unfortunately, this is no longer a viable option, as Microsoft has changed its images to work only under Virtual PC. If you follow the directions above, you get a copy of Windows that has to be reactived, and will then shut down after 3 days (thanks anonymous).
If like me you are an Ubuntu user and web developer, you'll have been after a convenient way to test in Windows based browsers, without having to reboot or switch computers. Sure, there's IEs4Linux, but I've never found it a pleasurable experience, and what about testing other browsers in Windows?
Finally, a really convenient solution has come along in the shape of VirtualBox and some Microsoft supplied machine images. As of version 2.1.0, VirtualBox supports the VHD hard disk image format, which means it can run the images Microsoft helpfully supply for testing websites with different IE versions on Windows XP SP2, Windows XP SP3 and Windows Vista. These copies of Windows expire after 3 months or so, but it's far better than using dodgy downloaded copies. If you are comfortable installing non-free software, this is a very effective setup.
This guide is based on the great 10 Volt Media guide to installing Internet Explorer on OSX using VirtualBox, I have simply converted their procedure to make it suitable for Ubuntu 9.04 users.
The Windows images do have a habit of blue screening when booted in VirtualBox, so you have to tinker with them a little bit to get it working, but it's simple enough if you follow this guide.
After updating this guide to use Virtualbox 2.2 and the new Windows disk images, I no longer get the dreaded blue screen of death, so no need to fiddle around in safe mode. The USB and Audio devices no longer work, I will look into a fix for those.
I describe how to install the WinXP/SP2/IE8 disk image, but you can easily use one of the others if you'd prefer.
That's enough blathering, let's get on with it...
Install Virtual Box
Add the following source to /etc/apt/sources.list, or use Synaptic etc if you prefer.
deb http://download.virtualbox.org/virtualbox/debian jaunty non-free
Or, if you are still using Intepid:
deb http://download.virtualbox.org/virtualbox/debian intrepid non-free
Add the Sun public key.
$ wget -q http://download.virtualbox.org/virtualbox/debian/sun_vbox.asc -O- | sudo apt-key add -
Install VirtualBox, accepting prompts to create the vboxusers group and compile the VirtualBox kernel module.
$ sudo apt-get update && sudo apt-get install virtualbox-2.2
Restart for good measure (and to get the VirtualBox menu item).
Download and extract the virtual hard disk image
Create a dir to hold the VHD file.
$ mkdir -p ~/VirtualMachines/HardDisks && cd ~/VirtualMachines/HardDisks
Download the IE8RC1-XPSP3.exe file, it's quite a large file so why not go and make a nice cup of tea...
$ wget http://download.microsoft.com/download/B/7/2/B72085AE-0F04-4C6F-9182-BF1EE90F5273/IE8-XPSP3.exe
Once it's finished, extract the vhd file.
$ unrar e IE8-XPSP3.exe XP\ SP3\ with\ IE8\ 2009-Apr.vhd
Remove the exe, you won't need that anymore.
$ rm IE8-XPSP3.exe
Create Virtual Machine
Launch VirtualBox from the Gnome menu, Applications > System Tools > Sun xVM VirtualBox
Create a new VM by clicking New.
Give it a name and set operating system as Windows XP.
Assign some RAM, no more than half your physical RAM is advisable.
At the Virtual Hard Disk screen click Existing to open the Virtual Media Manager.
Click Add and select the VHD file extracted earlier.
Click Select to close the Virtual Media Manager.
Click Next then Finish, you'll return to the main VirtualBox app which should now list your
new VM.
Configure Windows VM
Select the VM in Virtualbox then press Start to power it up
Dismiss any windows, dialogs, etc.
Devices > Install Guest Additions
Follow the prompts, accepting default values to install VirtuaBox Windows additions.
Choose to reboot machine when complete - Machine > Reset
Click OK to mouse pointer dialog, you won't need to maually capture the mouse again, handy!
Start > Run > "cmd"
> D:\VBoxWindowsAdditions-x86.exe /extract /D=C:\Drivers
Start > Administrative Tools > Computer Management
Select Device Manager.
Select Batteries, Unknown Device -> Disable
Select Sound, video and game controllers, Multimedia Audio Controller -> Disable
Select Universal Serial Bus controllers, Universal Serial Bus (USB) Controller -> Disable
Select Network Adapters, Ethernet Controller -> Update Driver
Select Yes, now and every time, click Next
Select Install from a list or specific location, click Next
Enter location "C:\Drivers\x86\Network\AMD"
Click Finish
Open a browser, test connection
You're done!
Bonus Tips
When closing the VM, choose "Save the machine state" to avoid watching tedious boot up screens when you restart it
Select Machine > Seamless Mode to hide the Windows desktop altogether leaving the application windows to run seamlessly alongside your Ubuntu windows. This is probably my favourite feature of VirtualBox :-)
Blue screen?
A previous version of this guide dealt with a problem where the Windows images would blue screen. This appears to have been fixed now, so try letting Windows boot first and hopefully everything will be fine, otherwise...
Hold F8 as the VM boots.
Choose "safe mode with command prompt".
Cancel any wizards, mising file dialogs that come up.
At the DOS prompt, enter
> cd \WINDOWS\system32\drivers
> ren processr.sys processr.old
Restart the VM - Machine > Reset