How to Install VirtualBox on Ubuntu Desktop

How to Install VirtualBox on Ubuntu Desktop

Oracle VM VirtualBox is a popular Type 2 hypervisor available for Windows, Mac, Linux, and Solaris. Unlike VMware Workstation Pro, VirtualBox is a free, open source, cross-platform virtualization software package.

In the following section, we are going to show you how to install VirtualBox on Ubuntu 18.04/16.04, So you can set up complete virtual lab environment on your Ubuntu Desktop/Server. To install VirtualBox we will use VirtualBox Ubuntu apt repository as described in the below steps.

This VirtualBox installation guide is compatible with both Ubuntu 18.04 LTS and the previous LTS version Ubuntu 16.04.

The first step is to add the VirtualBox apt repository, open the /etc/apt/sources.list file from a text editor. From the Ubuntu terminal you could type:

sudo gedit /etc/apt/sources.list

Then, add the following line to your sources.list file if you are using Ubuntu 18.04 LTS:

deb bionic contrib

For Ubuntu 16.04, Add the following line:

deb xenial contrib

Download and install apt key:

wget -q -O- | sudo apt-key add -

Update the source list and install VirtualBox:

sudo apt-get update
sudo apt-get install virtualbox-5.2

VirtualBox 5.2 is the latest stable version. Before installing, you can run apt-cache search command to find out what is the latest version available from the apt repository.

apt-cache search virtualbox

Also add your user account to the vboxusers Linux group:

sudo usermod -a -G vboxusers user_name

Replace user_name with the username of your Linux account.

Any user who wants to run VirtualBox on Ubuntu must be a member of the vboxusers group.

Downloading and installing the Extension Pack on Ubuntu

We need to install VirtualBox Extension pack to enable USB support as well as support for Preboot Execution Environment (PXE) booting. You need extension pack, If you want to be able to insert a flash drive on your Ubuntu PC and accessing it from within your Virtual Machine.

  1. First, download the Extension Pack from the following URL and save it to your computer.
    Download VirtualBox Extension pack for Ubuntu
  2. Open VirtualBox Manager and Go to File > Preferences > Extensions.
  3. Next, Click on the green plus icon on the right-hand side and select the extension pack that you downloaded earlier and click on Open.
  4. You'll be asked to confirm the installation. Click on Install.

Now you are ready to create Virtual Machines on Ubuntu VirtualBox.


Virtualization gives you the ability to install and run multiple operating systems in parallel to your main operating system on the same computer. Modern virtualization software like VirtualBox allows you to run multiple operating systems at the same time as long as your physical computer has enough hardware resources.

Today Oracle VM VirtualBox has many features, such as a hypervisor for the host platform, an application programming interface (API) and software development kit (SDK) for managing virtual machines, and a graphical user interface as well as a command-line tool that can manage guest operating systems.