The recommended way to install and maintain the Open Source (GPL v2) Virtual Box >= 4.0 in Ubuntu would be to add the following repository to your sources list:
deb http://download.virtualbox.org/virtualbox/debian <ubuntu-release> contrib
<ubuntu-release by your Ubuntu version, e.g.
oneiric). Then download and install the signature key:
wget -q http://download.virtualbox.org/virtualbox/debian/oracle_vbox.asc -O- | sudo apt-key add -
After updating your sources list with
sudo apt-get update
You can install Virtual Box via the Software Center or by typing
sudo apt-get install virtual-box-4.1
-4.1 by the current Virtual Box release). If you don't want to compile the kernel driver every time your kernel updates it is also recommended to install dkms by:
sudo apt-get install dkms
To gain extended functionality such as USB 2.0 support or support for Remote Desktop Protocol (RDP) you can make your Virtual Box installation closed source (see the Personal Use and Evaluation License) by downloading the Oracle Virtual Box Extension Pack and installing this by double click or with the Virtual Box Manager GUI under File -> Preferences -> Extensions:
To install an extension pack from command line we run the following command
VBoxManage extpack install [--replace] <tarball>
<tarball> with the path to your downloaded extension pack and use the option
--replace in case you have an older version of the extension pack already installed.
3D support (to run Unity), better desktop integration, changing the virtual screen geometry, and more can be achieved by installing the Guest Additions.