Dr. Dobb's is part of the Informa Tech Division of Informa PLC

This site is operated by a business or businesses owned by Informa PLC and all copyright resides with them. Informa PLC's registered office is 5 Howick Place, London SW1P 1WG. Registered in England and Wales. Number 8860726.

Channels ▼


Virtualization for Developers with VirtualBox

Eric Bruno is a contributing editor to Dr. Dobb's and can be contacted at [email protected].

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).

[Click image to view at full size]
Figure 1: VirtualBox with Solaris, Ubuntu, and Windows guests on my Mac OS X host machine.

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.

[Click image to view at full size]
Figure 2: Ubuntu guest running in VirtualBox on a Mac OS X host.

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.

Related Reading

More Insights

Currently we allow the following HTML tags in comments:

Single tags

These tags can be used alone and don't need an ending tag.

<br> Defines a single line break

<hr> Defines a horizontal line

Matching tags

These require an ending tag - e.g. <i>italic text</i>

<a> Defines an anchor

<b> Defines bold text

<big> Defines big text

<blockquote> Defines a long quotation

<caption> Defines a table caption

<cite> Defines a citation

<code> Defines computer code text

<em> Defines emphasized text

<fieldset> Defines a border around elements in a form

<h1> This is heading 1

<h2> This is heading 2

<h3> This is heading 3

<h4> This is heading 4

<h5> This is heading 5

<h6> This is heading 6

<i> Defines italic text

<p> Defines a paragraph

<pre> Defines preformatted text

<q> Defines a short quotation

<samp> Defines sample computer code text

<small> Defines small text

<span> Defines a section in a document

<s> Defines strikethrough text

<strike> Defines strikethrough text

<strong> Defines strong text

<sub> Defines subscripted text

<sup> Defines superscripted text

<u> Defines underlined text

Dr. Dobb's encourages readers to engage in spirited, healthy debate, including taking us to task. However, Dr. Dobb's moderates all comments posted to our site, and reserves the right to modify or remove any content that it determines to be derogatory, offensive, inflammatory, vulgar, irrelevant/off-topic, racist or obvious marketing or spam. Dr. Dobb's further reserves the right to disable the profile of any commenter participating in said activities.

Disqus Tips To upload an avatar photo, first complete your Disqus profile. | View the list of supported HTML tags you can use to style comments. | Please read our commenting policy.