Virtual Machines can make life much easier. IT departments can save a fortune on server hardware, desktop developers can test in a clean environment, and web developers can install multiple browsers on different operating systems.
Website testing should be easy, but there is one browser that causes more grief than others. Internet Explorer’s close ties with Windows means that only one version can be installed, so how can conscientious developers test IE8, IE7, IE6 and possibly IE5.0/5.5. There are workarounds, but all have flaws – especially on Vista. The best solution is to run clean copies of Windows with different versions of IE and that is where virtual machine software can help.
I have used VMware for many years. It was one of the first and most well-known VM solutions. However, I recently experienced performance issues on Vista and VMware Workstation v6 seemed a little bloated (500Mb download). Another option is Microsoft Virtual PC although it is more basic and has not been updated in several years.
Finally, we have VirtualBox, an open source project run by Sun Microsystems (for the moment, anyway). I tested version 1 a few years ago and, although it was adequate, it was no match for VMware. Now in version 2.2, I thought the product was worth another look.
Download and Installation
The VirtualBox 2.2 62MB download is larger than version 2.1 (36MB) but, unlike VMware, installation is very quick and it does not install quite so many RAM-hogging device drivers and services.
Creating a Virtual Machine
A step-by-step wizard is provided to create your first virtual machine. You enter a name, choose the amount of RAM, and create or select an existing virtual hard disk. The settings can then be tweaked before you boot for the first time, e.g. to choose an OS installation disk image in the virtual CD drive (I recommend using the excellent nLite to prepare a cut-down XP SP3 ISO).
Operating System installation is identical to installing on real hardware except that each virtual machine opens in its own window. Once complete, you can click the guest OS window and operate it as normal. By default, the right Ctrl key returns control back to the host. Like other solutions, VirtualBox provides guest OS software that installs various device drivers and automatic mouse capture/release (choose Devices > Install Guest Additions).
Virtual disk images are saved as .vdi files. You can either choose a fixed size drive or one that dynamically expands as the guest requires it. Unusually, VirtualBox allows you to run more than one virtual machine from the same disk image. You could therefore experiment with different hardware configurations, but I cannot think of any other practical use. Virtual disks can also be cloned so you can easily create a new guest OS from an existing installation. A command line tool is required for disk cloning but full instructions are provided in the help.
Other useful features include:
- Shared folders: permanently or temporarily connected folders that appear as a network drive in the guest OS.
- Snapshots: a snapshot of the guest OS can be taken at any point. This allows you to experiment with software installations or trash the whole system and revert back instantly (if only Windows Restore points did that!)
- State saving: when you close the OS window, you are given the choice to send a shut down signal, power off, or save the current state.
- Speed: VirtualBox feels much faster and responsive that VMware or Virtual PC.
- Seamless mode: like Parallels on the Mac, this integrates the guest OS on your standard desktop. It works well, although I could not get it to operate on a second monitor – which would be even more practical.
As for downsides, some might prefer VMware for:
- easier virtual machine cloning
- its tabbed interface (VirtualBox opens each guest OS in a separate window)
- file drag and drop between desktops (although VirtualBox’s shared folders are quicker in operation)
- smaller virtual disk images and shrinking options
- better commercial support options.
Overall, VirtualBox is excellent. It is far superior to VMware Server and matches many of the features found in the commercial Workstation product. It is also stable, works well on Vista, and is considerably faster than the competition. I never thought anything would beat VMware, but I have now switched to VirtualBox full time. At this price, it is highly recommended for all web developers.
- How to Build the Best Browser Test Suite
- Microsoft SuperPreview: a New Way to Test Web Sites
- VirtualBox website
Have you tried VirtualBox or another VM solution?
Craig is a freelance UK web consultant who built his first page for IE2.0 in 1995. Since that time he's been advocating standards, accessibility, and best-practice HTML5 techniques. He's created enterprise specifications, websites and online applications for companies and organisations including the UK Parliament, the European Parliament, the Department of Energy & Climate Change, Microsoft, and more. He's written more than 1,000 articles for SitePoint and you can find him @craigbuckler.
Your First Year in Code
Visual Studio Code: End-to-End Editing and Debugging Tools for Web Developers
Jump Start Git, 2nd Edition