There are two versions of VirtualBox available: one packaged by Ubuntu and one by Oracle. Both are free (libre) software (http://www.virtualbox.org/wiki/Editions).
There are separate gratis closed-source extension packs with a few extra features, such as USB 2.0 support.
Installing VirtualBox from Ubuntu repositories is easiest. Just install apt:virtualbox-qt.
To install Virtualbox from the Oracle repository, copy paste this command into a terminal:
sudo sh -c "echo 'deb http://download.virtualbox.org/virtualbox/debian '$(lsb_release -cs)' contrib non-free' > /etc/apt/sources.list.d/virtualbox.list" && wget -q http://download.virtualbox.org/virtualbox/debian/oracle_vbox.asc -O- | sudo apt-key add - && sudo apt-get update && sudo apt-get install virtualbox-5.0
The latest Virtualbox version at the time of writing was 5.0. If a newer version has since been released, please update the package name in the command to reflect that.
Instructions are compiled from information from: http://www.virtualbox.org/wiki/Linux_Downloads
See VirtualBox/Previous for information on detailed instructions for older versions of Ubuntu and Virtualbox.
Ubuntu 8.10 Intrepid Ibex
There is a known issue with VirtualBox and the Ubuntu 8.04 and later Server releases. The server release requires the PAE extension to be available on the virtual processor presented by VirtualBox to the guest OS. PAE support on the virtual processor is available in VirtualBox, but must be enabled on a per processor basis.
This is done either through the GUI,
Vm's Settings > General Section > Advanced Tab > Enable PAE/NX
or with the command
VBoxManage modifyvm <VM name> -pae on
This article is also valid for Ubuntu 8.10 Intrepid Ibex
Virtual Box 4.1.12-Ubuntu-r77245 on Ubuntu 1204 64b Desktop The settings to enable PAE/NX can be found in:- VM Settings > System Section > Processor Tab > Extended Feature: Enable PAE/NX
64 bit guests
A 64 bit host CPU is not enough to run 64 bit guests (in contrast to VMWare). The host must also be running a 64-bit OS and have hardware virtualization extensions enabled in the mainboard BIOS.