This post will describe three installation procedures for Linux (Ubuntu). You can install VirtualBox from the default repositories, from Oracle repositories or from deb file. Each has its advantages and disadvantages. Of course, the best method is the one that brings you the best results.
|VirtualBox main window|
1. Default repositoryThis is the easiest way to install VirtualBox. You can do it from the software center, from Synaptic Package Manager or from Terminal. In this way you will get a version that may sometimes be a little outdated, but tested with the OS version you are running. This may be the best option if you're looking for compatibility and stability. Before installing you should know that the virtualbox package only recommends (not requires) the Guest Additions ISO image and will not download it unless you select the package. Anyway, there should be no issue, because when you try to use Guest Additions, it will prompt you to download it.
|VirtualBox GuestAdditions ISO download|
sudo apt-get update && sudo apt-get install dkms virtualbox virtualbox-guest-additions-iso
2. Oracle repositoryUsing this method you will get the newest VirtualBox version every time it is released. You need to add the Oracle repository to your sources.list file and install the virtualbox-5.0 package. Copy and paste this in Terminal:
sudo apt-add-repository 'deb http://download.virtualbox.org/virtualbox/debian wily contrib' && wget -q https://www.virtualbox.org/download/oracle_vbox.asc -O- | sudo apt-key add - && sudo apt-get update && sudo apt-get install virtualbox-5.0Replace wily with the codename of your Ubuntu version. This method is recommended if you want to get the newest features and keep your VirtualBox installation updated.
3. PackageYou can also install VirtualBox by downloading the correct package for your system version and architecture and unpacking it. For this you should go to the Linux Downloads page for VirtualBox and choose the suitable package. After you download it, open a Terminal in the download directory, paste and run these commands:
sudo apt-get update && sudo apt-get install dkms && sudo dpkg -i virtualbox*.deb && sudo apt-get install -fIn this way you can install whatever version you choose (the one that works best for you) and you will get no updates.
These are the three ways to install VirtualBox in Ubuntu. You can now test and install different operating systems. These installation methods apply to other software too (default repository, developer repository or manual installation).