Tuesday, July 7, 2009

Installing Sun Virtualbox in Ubuntu 9.04 Without the Command Line

Using the Closed-Source Alternative

VirtualBox is full virtualization software for x86 and amd64 hosts. Binaries are compiled for Linux, OS X, Solaris, and Windows. Ubuntu repositories already include the open source version of VirtualBox, VirtualBox OSE (Open Source Edition). It can be installed by running
sudo apt-get install virtualbox-ose
or by adding the virtualbox-ose package in the synaptic package manager. Unfortunately, Sun has removed some features from the open source edition including:
  • USB Support
  • A virtual Serial ATA controller (which operates more efficiently than the virtual IDE controller in the open source edition)
These closed-source features allow Sun to charge for enterprise licenses. Fortunately, the full version of VirtualBox is free for personal use and evaluation, but it must be installed directly from the VirtualBox repositories.

Installation of Virtualbox is a simple affair. First we will need to add the VirtualBox repository.


Go to System > Administration > Software Sources. Click on the Third Party Software tab. You will see a list of your current repositories from which you can install software packages.


Click add in the bottom left to add a new repository. Copy
deb http://download.virtualbox.org/virtualbox/debian jaunty non-free
into the APT Line prompt and click add source.

As a security feature, you will also need to use the repositories GPG key. You can download the GPG key by right clicking on
http://download.virtualbox.org/virtualbox/debian/sun_vbox.asc
and saving the file to your desktop, or any folder of your choosing.


Now click the Authentication Tab to bring up a list of currently installed GPG keys. Click Import Key File.


Navigate to where you saved your gpg file, it should be named sun_vbox.asc. Select it and press ok.


Now you can press close to exit the Software Sources window. Before you leave it will ask you to reload the software repositories. Just press reload and wait for the window to close.

You can now add VirtualBox-3.0 to your system. Open the Synaptic Package Manager (System > Administration > Synaptic Package Manager) and do a quick search for virtualbox-3.0. Right-click on virtualbox-3.0 and select Mark For Installation.

Also do a quick search for dkms and mark it for installation. The dkms package ensures that VirtualBox will be compatible if your kernel is upgraded.


After you have marked both packages for installation, you can finish by pressing Apply.
You can now access Virtualbox from Applications > System Tools > Sun VirtualBox. When you run the program for the first time you will be asked to accept the license. Read the agreement, scroll to the bottom of the window, and press ok. You will also be asked to register register with Sun Online. I recommend registering now. Otherwise the program will nag you every time it starts.


To start the new virtual machine wizard, click new in the top left of the VirtualBox window.

Click next to navigate past the welcome page.


The next page asks you to name your new operating system, and choose the operating system type. Choose a name that is unique to the operating system you will be installing, in case you decide to add another. In this case I just used Windows XP.


Hit next to bring up a slider for memory allocation. Most users should be fine with 192MB, but if you have 2GB or more of memory you may want to allocate more.


Hitting next will bring up the hard drive configuration page. Unless you have already created a virtual disk image, you will need to create a new virtual drive. If you have already created a virtual disk image (.vdi) it will be stored in /home/user/.VirtualBox/HardDisks.


Hitting next twice more will bring up the new virtual hard drive wizard. This wizard will not partition your hard drive, it will only create an image file in your current operating system. Dynamically expanding size will allow this file to grow as space is needed. This is the option that most users should use.


The next page contains a slider to control the maximum size of the new image. 10GB should be fine for Windows XP, but to install Windows Vista, you will need at least 15GB, probably 20GB. You can also change the location of the image here, but unless you have a reason to do so, the default directory (/home/user/.virtualbox/HardDisks/) works well. Click finish to create the new virtual hard drive.


After you finish creating your disk image, you will need to install the guest operating system. Click Start to open the first run wizard.


VirtualBox will now tell you that it will capture your mouse and keyboard when you click inside its window. To release your mouse, just click right control. To dismiss this warning click ok.


The next page will allow you to configure your install media. If you are installing Windows XP, this will probably be from your Windows XP CD. Simply insert the CD in the drive, and tell VirtualBox to use that drive as the media source.

From here you should be able to install Windows XP just like any other installation. After completion, you will be able to run the virtual machine by clicking start from within VirtualBox. You can exit the machine by closing the VirtualBox window.