Or you might be about to make a serious change in your environment and need a safe way of making a complete backup with instantaneous restore if need be. Or maybe you want to try out different Linux distros without reformatting, but Live CDs don’t let you customise enough and USB sticks are too slow.
The solution to all these problems and more is virtualisation and the key players we check out here are VMWare, XenSource and Microsoft Virtual PC.
What is virtualisation?
The key concept behind virtualisation is that a pseudo-computer runs as an application just like any other application. Its file system is completely self-contained in distinct disk-based files. Any operating system installed on the virtual computer thinks itself to be running on a real machine, with a real hard disk. Other devices – monitor, keyboard, mouse, CD/DVD drives, sound, etc – are similarly handled.
Virtualisation differs from emulators like WINE in that the computer system itself is the focus. The virtual machine effectively runs a personal computer. An emulator strives to reproduce the functionality of a specific environment – like Microsoft Windows – and its coders thus have to cater for every system function that environment provides. This is why emulators will handle some programs well but not others.
The two downsides of a virtual machine are you need a legal copy of the operating system you want to run (which is a no-brainer for Linux) and also it will run slower than the same operating system on the actual hardware itself largely because the processor is working on other tasks at the same time.
However, the upsides are many. In particular a virtual machine can be ‘suspended’ and brought back alive at any time with all the memory contents immediately restored. And the fact that a virtual machine’s hard disk is just a disk-based file gives huge potential. For instance, a clean system can be set up. The disk-based hard disk can be copied just like any other file to allow a good, clean system to be brought back at any time. These copies can be used to seed further virtual machines. You can have two otherwise identical setups where one uses the latest version of a software package and the other has the second-latest release. Or where one has 256Mb RAM and the other has 512Mb RAM. Or where one uses Fedora Linux and the other Ubuntu. Or any other variation you can conceive of. Really, virtualisation is the ultimate testing platform and disaster recovery environment.
Where this comes into its own for Linux users like us is in four key ways.
Firstly, a wealth of different environments can be tried. If you want to try out any flavour of Linux you can construct limitless virtual machines without ever having to blow away your main system.
Secondly, you can construct complex server farms on a single piece of hardware. Each virtualised server has its own identity and its own IP address. Machines can pull mail from each other. They can browse web pages on each other. You can host client/server and n-tiered apps. You can experiment with the design of complex networks giving confidence to a proposed solution. Best of all, if anything becomes corrupted you just need to restore a backup of the hard drive file.
Thirdly, should you ever need Microsoft Windows for some purpose you can fire up a Windows virtual machine with greater reliability than that offered by Windows emulators.
Fourthly, all Linux distros are available for download as CD or DVD .iso image files. There’s no need to actually burn these to optical disc. Virtual machines can map the emulated optical drive to an ISO image whether or not the host operating system has support for that filetype.
In fact, you could easily run a whole bank of virtual machines from a portable hard drive – with distro ISO images, virtual hard drives, and virtual machine config files all located onboard. Take these around with you and you don’t just have data, you have actual servers and systems at your disposal.
The three main contenders are VMWare, XenSource and Microsoft Virtual PC, all of which are free or have free versions. Let’s see how they stack up.
Microsoft Virtual PC
Microsoft’s offering is Virtual PC. The latest desktop edition is 2007, which is the only version that works on Windows Vista. You can also download a server edition, Virtual Server 2005 R2. This is the best release and is also free; it lets your virtual machines start up at system boot making them always available and lets you control them remotely via a web interface. Even so both are dead simple to use. Each virtual computer you make runs in its own on-screen window and has its own hard disk file (.VHDs) and configuration settings.
However, where Virtual PC really sucks for Linux use is its abysmal support for X-Windows. I’ve been trying to install Fedora and CentOS and other distros only to find I can’t do anything as soon as the installation tries to fire up X-Windows. With Fedora, I thought the Virtual PC had just locked up. With CentOS, I could vaguely see the outline of what was meant to be displayed.
Depending on your needs, this may not be an issue; you can still run the Linux setup in text mode and you can still set up a Linux system for text terminal usage. Just be sure as soon as your distro of choice fires up that you pay attention to the very first screens. There will be a choice that permits you to install without a GUI, most usually by adding the clause ‘text’ to the end of the boot command. You might also then like to customise the packages that will be installed to make sure X-Windows is excluded. If you are running a Linux distro primarily for server use, then the lack of X-Windows may not prove a problem.
You don’t always have to make your own virtual machines: Microsoft themselves make available a range of VHD files to allow evaluation of their products but these are only Windows systems. Scouring the Internet you may find Linux-based VHDs made by others.
Nevertheless, at the end of the day, Virtual PC is a Microsoft Windows product; it will let you install the OS of your choice but the host environment has to be Windows.
By contrast, VMWare does everything Virtual PC does and handles X-Windows flawlessly. The display issues of Virtual PC are non-existent with VMWare – and versions are available for Linux as well as Windows. Really, if you use Linux or want to use Linux there’s only one choice.
Additionally, VMWare runs multiple virtual machines in a tabbed environment rather than separate windows. Although largely a matter of preference, this can make management easier. Hard drives are still disk-based file, with the extension .vmdk.
The catch with VMWare is that its free player won’t let you create new virtual machines; you need to have someone else make the system for you. You can then freely use it and modify it with the player, you just can’t make a brand new one from scratch. The mid-range VMWare Workstation can create new virtual machines but it is a commercial product. Fortunately, there are free third-party tools to help here. One is VMX Builder and IronGeek have a video tutorial showing how to use it.
Curiously though, the VMWare Server is also free. Like Virtual Server, you can start up your virtual machines automatically on system boot. You can also make new virtual computers, so it makes a better choice than the Player. You’ll need to register to get a serial key to use it but this is a painless process and costs no money.
Irrespective, here’s the great thing: VMWare has a great user fan base and it is much easier to find Linux-based VMDKs. One especially brilliant site is TuxDistro. This is a legal BitTorrent site which does nothing besides distribute Linux distros – as ISO images and as compressed VMDX files. You can find perennial favourites like Ubuntu and Knoppix here but also specially customised systems like 64 Studio – a Debian remix tailor made for digital content creation. In fact, this adds another compelling reason in support of virtual machines: it’s much easier for someone to set up a base Linux installation then tweak it to suit their needs then distribute it to friends and family if it is a virtual hard disk than it is to make a Live CD distro.
Perhaps lesser known that the other two is XenSource. It comes in three flavours with its low-end XenServer Express edition being free. The sole limitations of this version are that it only permits up to four virtual machines per server, and that the administrator can only manage one virtual machine at a time. Apart from this, it too is a better choice for Linux users than Microsoft's offering because it will run on Linux operating systems and it will display X-Windows fine.
One especially nice thing about XenSource is that it is open source and that it also contributes back to Linux. Recently, patches by XenSource were included by Linux directly into the Linux kernel and this commitment to the community deserves to be well-regarded.
I urge you to try out virtualisation; it really is a brilliant, simple, elegant and effortless way to evaluate distros side-by-side and to manage a genuine server farm for just the price of one single hardware setup.