Sunday, November 25, 2012

Installing VirtualBox On Ubuntu

This tutorial shows how you can install InnoTek's VirtualBox on a Ubuntu desktop. With VirtualBox you can create and run guest operating systems ("virtual machines") such as Linux and Windows under a host operating system. There are two ways of installing VirtualBox: from precompiled binaries that are available for some distributions and come under the PUEL license, and from the sources that are released under the GPL. This article will show both ways.
Currently VirtualBox supports only 32bit host and guest operating systems.
This document comes without warranty of any kind! I want to say that this is not the only way of setting up such a system. There are many ways of achieving this goal but this is the way I take. I do not issue any guarantee that this will work for you!

1 Installing VirtualBox From Precompiled Binaries

The VirtualBox binaries can be downloaded from here: http://www.virtualbox.org/wiki/Downloads. If the PUEL license is ok for you and there's a package for your distribution, you can install that package. For example, there is a VirtualBox .deb package for Ubuntu 6.10 (Edgy Eft), so if you use Ubuntu 6.10, you can use that package. I've also tested this package successfully on Ubuntu 7.04 (Feisty Fawn), so it seems you can use that package there, too.
To install the VirtualBox .deb package, please open a terminal window (Applications > Accessories > Terminal) and become root:
sudo su
Then install some prerequisites for VirtualBox:
apt-get install bcc iasl xsltproc xalan libxalan110-dev uuid-dev zlib1g-dev libidl-dev libsdl1.2-dev libxcursor-dev libqt3-headers libqt3-mt-dev libasound2-dev libstdc++5 linux-headers-`uname -r` build-essential
Then go to the VirtualBox download page and pick the right .deb package for your Ubuntu version and download it to your system:
cd /tmp
wget http://www.virtualbox.org/download/1.3.8/VirtualBox_1.3.8_Ubuntu_edgy_i386.deb
After the download has finished, you can install VirtualBox like this:
dpkg -i VirtualBox_1.3.8_Ubuntu_edgy_i386.deb
You might get asked the following questions:
Do you agree with the PUEL license terms? <-- Yes
Should the vboxdrv kernel module be compiled now? <-- Yes
That's it already. You can now find VirtualBox under Applications > System Tools:


2 Installing VirtualBox From The Sources

If InnoTek's PUEL license doesn't work for you and you prefer the GPL and/or there's no .deb package for your Ubuntu version, you can compile VirtualBox from the sources. The sources are released under the GPL.
To install VirtualBox from the sources, please open a terminal window (Applications > Accessories > Terminal) and become root:
sudo su
Then install some prerequisites for VirtualBox:
apt-get install bcc iasl xsltproc xalan libxalan110-dev uuid-dev zlib1g-dev libidl-dev libsdl1.2-dev libxcursor-dev libqt3-headers libqt3-mt-dev libasound2-dev libstdc++5 linux-headers-`uname -r` build-essential
We can download the latest VirtualBox sources from InnoTek's SVN repository; to do so, we must install subversion first:
apt-get install subversion
Next we download the VirtualBox sources to the /usr/src/virtualbox directory: