VirtualBox is a free virtualisation software for x86 based systems and is available for most of the popular OSes like linux, mac and windows. It runs on a host system and supports running other OSes as guest. It earlier belonged to Sun and now to Oracle.
At the time of this post, virtualbox 4.3.2 is the latest version and was released in Nov-2013. To learn about what is new in this version, check the Change Log.
Install virtualbox on Ubuntu from oracle repository
Oracle provides debian compatible repositories for installing virtualbox via apt command on debian/ubuntu based systems. So first we shall check the steps to install it like that.
Add the repository
Virtualbox provides repositories for various versions of ubuntu and debian. Pick up the correct repository from the list that matches your OS version.
deb http://download.virtualbox.org/virtualbox/debian saucy contrib deb http://download.virtualbox.org/virtualbox/debian raring contrib deb http://download.virtualbox.org/virtualbox/debian quantal contrib deb http://download.virtualbox.org/virtualbox/debian precise contrib deb http://download.virtualbox.org/virtualbox/debian lucid contrib non-free deb http://download.virtualbox.org/virtualbox/debian wheezy contrib deb http://download.virtualbox.org/virtualbox/debian squeeze contrib non-free
For other Ubuntu derivates like Mint, Elementary OS etc, find out the ubuntu versions on which they are based and choose repository of the corresponding ubuntu version.
After selecting the correct repository, add it to the apt repository list with the apt-add-repository command.
$ sudo apt-add-repository 'deb http://download.virtualbox.org/virtualbox/debian saucy contrib' -y
Import the key
After adding the repository url, the next step is to import the keys.
$ wget -q http://download.virtualbox.org/virtualbox/debian/oracle_vbox.asc -O- | sudo apt-key add -
Update the apt cache and install
Now the repository is fully setup, so move ahead to installing the package.
$ sudo apt-get update $ sudo apt-get install virtualbox-4.3
Thats it. Now virtualbox 4.3 installation is complete. There should be a launcher icon in application menus of Gnome/KDE from where it can be launched comfortably.
It will automatically install the previous version of virtualbox if they were installed from ubuntu repositories.
It ideal to use the virtualbox repositories from Oracle since it would always have the latest version.
Install Virtualbox directly from deb files
The alternative method of installing virtualbox is by using the deb files directly. The deb files can be downloaded from following urlhttps://www.virtualbox.org/wiki/Linux_Downloads
The page contains download links for various linux distros and architectures. The download files can also be browsed over herehttp://download.virtualbox.org/virtualbox/
Browse into the latest version and then the preferred distro/OS.
So over here we download the latest version for Ubuntu Raring and compatible systems.
$ wget http://download.virtualbox.org/virtualbox/4.3.2/virtualbox-4.3_4.3.2-90405~Ubuntu~raring_amd64.deb
Now remove older virtualbox versions if any
$ sudo apt-get remove virtualbox-4.2
Install the latest deb file with dpkg or gdebi
$ sudo gdebi virtualbox-4.3_4.3.2-90405~Ubuntu~raring_amd64.deb or $ sudo dpkg -i virtualbox-4.3_4.3.2-90405~Ubuntu~raring_amd64.deb
That should install it right away and complete the process
Install virtualbox on Fedora from Oracle repository
Now its time to do the setup of the rpm based linux distros, that is Fedora etc. Over here we shall be doing it on Fedora only.
Add the repository
To add the virtualbox repository to fedora create a file named virtualbox.repo in /etc/yum.repos.d/ and add the following content to it.
$ sudo nano /etc/yum.repos.d/virtualbox.repo
[virtualbox] name=Fedora $releasever - $basearch - VirtualBox baseurl=http://download.virtualbox.org/virtualbox/rpm/fedora/$releasever/$basearch enabled=1 gpgcheck=1 gpgkey=http://download.virtualbox.org/virtualbox/debian/oracle_vbox.asc
The above contents can be downloaded from the the following url as wellhttp://download.virtualbox.org/virtualbox/rpm/fedora/virtualbox.repo
Or write directly
$ sudo wget http://download.virtualbox.org/virtualbox/rpm/fedora/virtualbox.repo -O /etc/yum.repos.d/virtualbox.repo
Now update the yum cache and list the virtualbox packages
$ yum list *virtualbox* Loaded plugins: langpacks, presto, refresh-packagekit Available Packages VirtualBox-4.2.x86_64 4.2.18_88780_fedora18-1 virtualbox VirtualBox-4.3.x86_64 4.3.2_90405_fedora18-1 virtualbox
So there we can see the virtualbox packages from the oracle virtualbox repository. Now its time to install. So go ahead with yum once again
$ sudo yum install VirtualBox-4.3
That would install VirtualBox 4.3 on the Fedora system. It would also pull in a few qt packages as dependencies, if they are not already present on the system.
Install virtualbox on Fedora with rpm files
Oracle also provides rpm files for Fedora 17/18/19 that can be downloaded and installed using the rpm command. Get the download link for your Fedora version and architecture over herehttps://www.virtualbox.org/wiki/Linux_Downloads
In this example we are downloading for Fedora 18 - 64bit
$ wget http://download.virtualbox.org/virtualbox/4.3.2/VirtualBox-4.3-4.3.2_90405_fedora18-1.x86_64.rpm
The download size is around 72MB so would take a few minutes to complete. Once the download completes, simply fire up the yum command to install the package.
$ sudo yum install VirtualBox-4.3-4.3.2_90405_fedora18-1.x86_64.rpm
You may be surprised to know that the yum command can install rpm package files as well and will automatically install any necessary dependencies along the way. This is very handy. The rpm command cannot be used, since it cannot install dependencies and would simply stop.
So we learnt the steps to install VirtualBox on both Ubuntu and Fedora. Try it out and enjoy!!