Eric Bruno is a contributing editor to Dr. Dobb's and can be contacted at eric@ericbruno.com.
As a developer, you most likely need to work with all types of systems: Windows, Linux, Solaris, and so on. Perhaps you even need to work with DOS, NetWare, or other legacy operating systems. Even if you develop in a homogenous environment, perhaps you need to test network code, where your application is distributed across multiple machines. It may be costly or inconvenient to maintain a separate physical web server, application server, and database server per developer. Virtualization can help tremendously here, and it doesn't have to be expensive, heavyweight, or difficult to use.
In this article, I describe VirtualBox open source virtualization software that runs on Windows, Mac OS X, Linux, Solaris, and OpenSolaris. On any of these platforms, you can run Windows, Linux, Solaris, OpenSolaris, BSD Unix, QNX, OS/2, and even MS-DOS guest virtual machines. There's support for fast startup and shutdown of virtual machines, access to hardware-based graphics acceleration, true multicore support as well as multiprocessor emulation, integration of system taskbars, seamless operation (where windows of multiple OS's appear together on the host machine), 64-bit and 32-bit host/guest support, and various networking options.
VirtualBox: Getting Started
The native operating system upon which you install and run VirtualBox is called the "host OS", the "host system", or simply the "host". When you install and run a virtual machine in VirtualBox, it's called a guest machine, a guest OS, or simply a guest. Go to http://virtualbox.org to download and install VirtualBox for your host development machine. My development machine is a MacBook Pro, but I often do Windows development on my Mac with VirtualBox, as well as real-time systems development on Linux and Solaris. The advantage is that wherever I bring my Macbook, all of these other environments come along with me (see Figure 1).
When you create a new guest OS to install, you select the OS type (and proper distribution for Linux), set the amount of memory and hard drive space to make available to the guest, and create a virtual disk to install the OS onto. You can specify the disk as a dynamically expanding storage file, which starts out very small and grows to a maximum only as the guest OS requires.
For instance, say you specify a virtual disk for Ubuntu 9.10 to be 60GB in size. If you mark it as a dynamically expanding file, after installation, it will consume less than 4GB of actual space on your host hard drive. As you install other software packages on your guest (i.e., OpenOffice, Eclipse, gcc, and so on), the file will expand to hold these packages. As a result, you won't needlessly consume hard drive space on your host machine unless you need it.
Figure 2 shows Ubuntu Linux 9.10 running as a guest in VirtualBox on my Mac OS X host. The entire OS runs within a window on Mac OS X. It can be minimized, resized, or closed to shut it down.
You may notice an icon in the upper left corner of the Ubuntu desktop. VirtualBox exposes a virtual CD from which you can install a set of drivers called "VirtualBox Guest Additions". Let's take a look at this now, the features it brings, and the guest operating systems supported.


