How To Setup Virtualbox on Ubuntu 16.04

Virtualbox is an advanced virtualization platform. It runs on Windows, Linux, Macintosh, and Solaris hosts and supports a large number of guest operating systems. It is available as Open Source Software (GPL2). It is lightweight and actively developed, so it is suitable for use in workstations.

I use Virtualbox to create virtual machines mainly for testing:

  • to test my current Operating System before applying major changes to running version
  • to test my software projects in a clone of a production (Debian) server
  • to test my software projects in Microsoft Windows workstations

This is a simple guide to setup Oracle Virtualbox on Ubuntu 16.04

Add Oracle Virtualbox repository

Using command line (recommended)

With your favorite editor (nano in my case), create the file

sudo nano /etc/apt/sources.list.d/virtualbox.list

Add the following and save the file

deb http://download.virtualbox.org/virtualbox/debian xenial contrib

Download and add the key

wget https://www.virtualbox.org/download/oracle_vbox_2016.asc
sudo apt-key add oracle_vbox_2016.asc

Update software sources (as usual)

sudo apt-get update

Finally, install Virtualbox (current version is 5.1)

sudo apt-get install virtualbox-5.1

You can access Virtualbox using Ubuntu Unity Dash (see image) or from the applications menu in other Ubuntu flavors. Open Dash (press SUPER key) and type something like “virtual”

Now, you can manage your virtual machines using Virtualbox Manager:

Using “Software & Updates”

In case you do not prefer to use command line interface, you may add this repository using “Software & Updates”

Software & Updates → Other Software → Add

Add yourself to vboxusers group

This is necessary in order to be able to use host USB devices from virtual machines. See here.

sudo adduser YOURUSERNAME vboxusers

Logout and login for this to take effect.

Install (or Upgrade) Extension Pack

VirtualBox Extension Pack offers support for USB 2.0 and USB 3.0 devices, VirtualBox RDP, disk encryption, NVMe and PXE boot for Intel cards. More info here. It is highly recommended to install it.

You may install it from the repositories (as usual)

sudo apt-get install virtualbox-ext-pack

but this is not a good idea, as you will NOT install the latest version. So, the first time

You will see something like this

From now on, every time you open Virtualbox Manager after an update, you will be prompted to update Extension Pack. This process will look like:

In this step press “Download”

Confirm “Download”

In this step press “Install”

Press “Upgrade”

Press “OK”

Press “Delete”

Open Virtualbox manager → File → Preferences → Extension → and you will see that the latest version of Extension Pack has been installed.

Conclusion

Just follow these three simple steps:

  • Add Oracle Virtualbox repository, then install Virtualbox using apt-get
  • Add yourself to vboxusers group
  • Install Extension Pack

Your comments are welcome!