The recommended way to install and maintain the Open Source (GPL v2) Virtual Box >= 4.0 in Ubuntu would be to
Add the Oracle repository to your sources
For 32-bit system or when multiarch is not enabled:
sudo add-apt-repository "deb http://download.virtualbox.org/virtualbox/debian $(lsb_release -cs) contrib"
The Oracle repository does not support multiarch. For 64-bit multiarch systems we add the repository with (source here)
sudo add-apt-repository "deb [arch=amd64] http://download.virtualbox.org/virtualbox/debian $(lsb_release -cs) contrib"
You may also read notes on how a repository or a PPA works.
Download and install the signature key
wget -q http://download.virtualbox.org/virtualbox/debian/oracle_vbox.asc -O- | sudo apt-key add -
Udate your sources cache
sudo apt-get update
Install Virtual Box via the Software Center or command line
sudo apt-get install virtual-box-5.0
-5.0 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
Download and install the Extension Pack
To gain extended functionality such as USB 2.0 or USB 3.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.
You have to visit the Oracle Virtual Box Download page to obtain the present download link with Virtual Box
<version> and the current
<filename> of the extension pack available for download.
Note: Extension packs always need to be for the same Virtual Box version.
Install is done 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] <filename>
<filename> 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.
Note: On upgrading Virtual Box to a newer version we also have to manually upgrade the extension pack. This will not be done automatically from the repository.
3D support (to run Unity), better desktop integration, changing the virtual screen geometry, and more can be achieved by installing the Guest Additions.