Virtualization using VirtualBox
Do you feel like trying lots of different distributions? Do you absolutely have to run some Windows application (for example, Visual Studio)? Then maybe virtualization is the answer for you.
Introduction
What is virtualization? Well, in it’s most basic terms it means running an operating system (or part of an operating system) on top of another. Virtualization is typically divided into five different types, which are:
- Full virtualization
- Hardware-assisted virtualization
- Partial virtualization
- Paravirtualization
- Operating System-level virtualization
We’re going to focus on full virtualization in this article. If you really want to learn about the others, please read the Wikipedia page on Platform Virtualization. Something that may interest you is that the server that runs this web-site uses operating system-level virtualization, namely Open VZ.
Full Virtualization
Full virtualization means that the virtualization software provides a full simulation of the underlying hardware for the operating system. This means that the virtualization software creates a virtual machine which is capable of running pretty much any operating system. This means that you can run Windows as a guest on a Linux host, or even the other way round.
Examples of software that use full virtualization include:Windows Server 2003 Guest
- VirtualBox
- VMWare Workstation
- Parallels Workstation
In this article we’re going to be using VirtualBox, which is free and also has an open source edition available.
VirtualBox
Installation
If you don’t already have VirtualBox installed, don’t worry; installation is a breeze.
Most major distributions will have the open source edition available in their repositories but, despite this, I’d recommend using the binary version found on the VirtualBox site. It’s still free, but it includes some improvements that aren’t available in the open source edition. Some of the advantages of the closed-source version include:
- USB support
- RDP support
- A virtual Serial ATA controller
Installing the closed-source version is almost as easy as using the version found in the repositories. Just head over to the VirtualBox download page and download the package for your distribution (Some distributions may have the closed-source version available in their repositories).
Gentoo users can just run (if you want the latest version, you’ll have to unmask it):
emerge -av virtualbox-bin
If you run into any problems, consulting the VirtualBox Community forums, Ubuntu forums, or any support forum of your choice should help you solve your issue. Of course you can also consult us at HHLC…
Running VirtualBox
Now that you have VirtualBox installed (I’d recommend rebooting after the install, just in case) you can simply open it through your applications menu.
Create a New Virtual Machine
Now that you have VirtualBox up and running, you should have a window similar to the one below in front of you.

Of course you won’t have any virtual machines yet…
The next step is to click on the New button in the toolbar in order to launch the virtual machine setup wizard. You’ll need to enter some information on the type of guest OS you’ll be running and some basic hardware parameters (RAM, hard disk size etc). VirtualBox will automatically suggest values for some of the options based on which guest OS you selected. Also remember that you’ll need the installation media for what ever guest OS you’re going to install, either a physical CD/DVD or an ISO disc image.
When you create the virtual hard disk for the guest you’ll be presented with a choice of Fixed-sized image or Dynamically expanding image. A fixed size image means that the full size will be allocated at once, where as a dynamically expanding image will only occupy as much space as the guest OS does.
A fixed size image is supposed to have a slight performance advantage, but it does have the disadvantage of occupying more space on your hard drive. I’ve always used dynamically sized images and have been quite happy with the performance.

Once you’re done creating the new HDD image, you’ll be at the end of the wizard. Next you should make sure that the settings are what you need.
Virtual Machine Settings
If you made a mistake during the wizard, don’t worry; you can correct it here.

The settings dialog will allow you to adjust almost every aspect of the virtual machine. You can, for example:
- Increase or decrease the amount of RAm allocated to the guest OS
- Increase or decrease the amount of video memory
- Adjust the boot order
- Choose what to mount to the CD/DVD drive on boot
The first thing you should do is change the primary HDD from IDE to SATA.

Do this by going to the Hard Disks section, clicking Enable SATA controller and then changing the slot on your disk image to SATA Port 0.

Next choose what disc media you want in the virtual CD/DVD drive on boot. Either insert a disc into your computer’s disc drive and use that, or select a disk image from your hard drive.
After that’s done you can close the settings window and start up you’re virtual machine. The installation procedure will be exactly that same as it is for a real operating system installation.
Once you’ve installed the Guest OS you can install the VirtualBox Guest Additions. Te Guest Additions are a set of tools and drivers that help you get the most out of your virtual machine. If you have a compatible guest OS you get features such as:

- Mouse pointer integration
- Better video support
- Time synchronization
- Shared folders
- Seamless windows (as seen below with Windows Server 2003 running on Gentoo)
- Shared clipboard
- Automated Windows logons (credentials passing; Windows guests only)
Conclusion & Further Reading
This has been a very quick and generic introduction to virtualization and to VirtualBox. If you’d like to learn more, or feel like you need more instructions, I’d suggest the following resources:
- The Wikipedia article on full virtualization (for a general overview)
- VirtualBox HOWTOs
- VirtualBox user manual
- VirtualBox Community forums
- VirtualBox tutorial by the Free Software Magazine