Lately I’ve been interested in learning about a variety of the Operating Systems that are available today. I’m a big advocate of using the right tool for the job so experimenting with the latest OSes is a must in order to figure out the strengths and weaknesses of each. While experimentation is a great way to learn it can be a bit of a pain to find an old machine, format the hard drive, and install an OS. Dual booting is an alternative option, but there is the inherent risk of messing up the current state of your machine.
Overcoming these issues was always a bit of a challenge for me until about six months ago when I stumbled upon VirtualBox. VirtualBox is Sun’s “family of powerful x86 virtualization products.” VirtualBox allows you to install and run “guest” operating systems in their own virtual environment on top of a “host” operating system. I know that virtualization has been around for a while, but until finding VirtualBox, I’ve never had much success running virtualization software. VirtualBox is different. It’s intuitive and easy to use. Here are the top 5 reasons why I love VirtualBox:
If you’ve ever wanted to try out a particular OS, but didn’t feel like dealing with the hassles mentioned above then VirtualBox may be exactly what you are looking for. VirtualBox allows you to install guest operating systems in their own virtual environment which means there are no side effects on the current state of your machine (other than taking up some hard drive space of course). If you mess something up simply discard your virtual machine (VM) and start over.
The net effect is that you save a lot of time. No need for additional machines, formatting, or partitioning. Simply create a new VM, mount the CD drive (or an .iso image of the OS you want to install), and fire up the virtual machine.
VirtualBox allows you to install a wide range of OSes including, but not limited to Linux (Ubuntu, etc.), BSD, Solaris, Windows (including 3.1). For a full list of guest operating systems click here.
When I first started dual booting years ago I appreciated the fact that it was possible to run two (or more) operating systems on the same machine. This proved to be very useful when I wanted to play video games, write, or work with multimedia and graphics tools using Windows, but wanted to develop software using the tools available under various flavors of Linux. There was a problem however. Sometimes I would want to do work that required tools available in one of the OSes but not the other. Other times I would simply prefer to work in a way that favored a particular operating system. In either case I would often have to reboot my machine, select a particular OS, do my work in that OS, and then reboot back to my main operating system. As you can imagine this was quite painful.
With VirtualBox you can have the best of all worlds. You can work with as many OSes as you want at the same time. I do this a lot particularly when developing websites. I can run a full LAMP stack on an Ubuntu Linux guest operating system while I use photo editing software on my Windows host machine. As a bonus you can place the guest OS into “Full Screen” mode and be totally ignorant of the fact that you are running a virtualized operating system. Best of all: No reboots required.
One of the most exciting aspects about VirtualBox for me is that networking works between guest and host operating systems, guest and other guest operating systems, and guest operating systems and external networks (i.e. the Internet). This has a lot of interesting implications. One thing that I’ve been able to do is set up an old Dell computer in my closet running two VirtualBox VMs. I have Ubuntu Linux installed on both VM instances. I use one VM to serve as a centralized Git source code repository (you are using Git, right?). The other VM hosts a LAMP stack for serving a simple Wiki. On my network these two VMs act as individual machines. I can restart, shutdown, or in any other way modify one VM without disrupting the other.
With previous versions of VirtualBox networking could be slightly cumbersome to set up, but version 2.1 makes setup a breeze. If you do try VirtualBox and get caught up along the way there is plenty of documentation and a strong development community to help you out along the way.
I once spent a lot of time setting up one of my virtual machine guest environments to the exact specifications that I needed. I downloaded tons of software, added bash aliases, and tweaked various configurations to suit my needs. Then an interesting thing happened. I ended up needing another VM with the exact same specifications. Taking the time to manually configure another VM wasn’t really an option. Fortunately VirtualBox has built in VM cloning* support. All I had to do was run the following command:**
VBoxManage clonehd </path/source.vdi> </path/target.vdi> -format VDI
This saves a lot of time by reducing the effort needed to reproduce the guest virtual machines that you have previously set up using VirtualBox. This also allows you to share your environment with other people by simply giving them access to your .vdi file (VirtualBox VM instance) and configuration settings. In addition, once you set up a pristine environment you can clone it and always have it stored as a backup incase you mess something up with the VM you are currently working with.
*There is a bit of a bug in VirtualBox 2.1. The
clonehd command seems to be generating corrupt .vdi files. In the meantime as a work around you can simply copy the .vdi file, paste it into a target directory, and then run
VBoxManage internalcommands sethduuid <target.vdi> command (thanks to The Bonobo Journal for the tip).
**Note: On Windows don’t forget to make sure you add the VBoxManage application to your path so that you can run it from the command line.
If you decide to install VirtualBox you will definitely want to install the “Guest Additions” package that is available for most guest operating systems. Guest Additions allow for better interoperability between your installed guest VMs and your host system. A few of the best features included with Guest Additions are:
Shared Clipboard – gives you the ability to bi-directionally copy and paste text between guest and host operating systems.
Independent Mouse Control – permits you to move your mouse between guest and host systems. Without Guest Additions installed your mouse is “captured” by the guest virtual machine until the “Host Key” is pressed (usually the right
Better Video Support – allows you to resize your VM window while also dynamically resizing the screen resolution of your guest operating system.
Besides simply saving time, space, and energy there are a lot of real world applications for VirtualBox. I really like to setup multiple VMs on my host machine to serve as development and staging environments for the various web applications that I work on. Also I like to test my web applications using a combination of different operating systems and browsers (especially various Windows/Internet Explorer combinations). With VirtualBox this is all very straight forward. In the future I would like to use VirtualBox to experiment with running multiple VMs over a network to learn more about setting up clustered, load balanced environments.