How to Install VirtualBox on Ubuntu 18.04

 VirtualBox is an open source cross-platform virtualization software that allows you to run multiple operating systems (virtual machines) at the same time.

In this tutorial, I will show you two different methods on how to install VirtualBox on your Ubuntu 18.04 OS. The first method describes the steps required to install VirtualBox 6.0 from the Oracle repository while the second will show you how to install the latest version of Virtual Box from the official Ubuntu repositories.

The VirtualBox packages available in the Ubuntu multiverse repositories may not always be the latest versions. If you want to have the latest version of Virtual Box then the recommended way is to install VirtualBox from Oracle repository.

This guide also applies to Ubuntu 16.04 and other Ubuntu-based Linux distributions, including Linux Mint and Elementary OS.


Before proceeding with this tutorial how to install Virtual Box on Ubuntu, make sure you are logged in as a user with sudo privileges. Read → How to Create a Sudo User and Sudo Group on Ubuntu.

Install VirtualBox from Oracle Repository

virtual box

At the time of writing this article, the latest version of Virtual Box is version 6.0. Before proceeding with the next steps, you should check the VirtualBox download page to see if a newer version is available.

To install VirtualBox from the Oracle repository on your Ubuntu operating system, follow these steps:

Start by importing the GPG key from the Oracle Virtual Box repository to your system using the wget following command:

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

Both commands should display OK which means that the GPG Key has been successfully imported and packages from this repository will be considered trusted.

Next, add the APT Repository VirtualBox with the command add-apt-repository as shown below:

		$ sudo add-apt-repository "deb [arch=amd64] $(lsb_release -cs) contrib"

$ (lsb_release -cs) will print the Ubuntu codename. For example, if you have a version of Ubuntu 18.04 the command will print the name bionic .

If you get an error message saying command add-apt-repository not found then you need to install the software-properties-common .

Once the VirtualBox repository is enabled, update the list apt package and install the latest version of VirtualBox 6.0 by typing the following command:

$ sudo apt update
$ sudo apt install virtualbox-6.0

Install VirtualBox Extension Pack

The VirtualBox Extension Pack provides several useful functions for Guest Machines such as virtual USB 2.0 and 3.0 devices, support for RDP, image encryption and more.

Download the extension pack file by typing:

		$ wget

Make sure the Extension Pack version matches the Virtual Box version.

When the download is complete, import the extension pack using the following command:

		$ sudo VBoxManage extpack install Oracle_VM_VirtualBox_Extension_Pack-6.0.0.vbox-extpack

You will be granted an Oracle license and asked to accept their terms and conditions.

	Do you agree to these license terms and conditions (y/n)?

Type and press Enter . Once the installation is complete, you will see the following output:

	Output0%...10%...20%...30%...40%...50%...60%...70%...80%...90%...100%Successfully installed "Oracle VM VirtualBox Extension Pack".

Install Virtual Box from Ubuntu Repository

Installing Virtual Box from the Ubuntu repositories is a very easy process, just run the following command:

$ sudo apt update
$ sudo apt install virtualbox virtualbox-ext-pack

Start Using Virtual Box

Now that VirtualBox is installed on your Ubuntu system, you can open Virtual Box from the command line by typing virtualbox or by clicking on the Virtual Box icon ( Activities -> Oracle VM VirtualBox ).

When you start Virtual Box for the first time, a window like the following will appear:


You have learned how to install Virtual Box on your Ubuntu 18.04 OS. You can now install Guest Machine like any other Windows OS or Linux Distro. To find more information about Virtual Box, visit the official Virtual Box documentation page.