How to Install VirtualBox on Ubuntu

June 2, 2019


VirtualBox is a powerful free tool by Oracle for running a virtual operating system on your computer. In this tutorial learn how to install VirtualBox on Ubuntu and other Debian-based Linux distributions.

How to install VirtualBox on Ubuntu??


  • A user account with sudo privileges
  • A terminal window (Ctrl-Alt-T)

Option 1: Install VirtualBox from Ubuntu Repositories

The easiest way to install VirtualBox is by using the official Ubuntu repositories.

1. Open a terminal, and enter the following:

sudo apt-get update
sudo apt-get install virtualbox

2. Next, install the VirtualBox Extension Pack:

sudo apt-get install virtualbox—ext–pack
How to install VirtualBox extension pack?

The Extension Pack enhances VirtualBox by adding USB 2.0 and 3.0 support, remote desktop, and encryption.

Option 2: Installing VirtualBox from Oracle’s Repositories

Often the default repositories do not have the latest versions of the software. They may work for test environments, but some users need the latest security or functionality patches. This process is more in-depth but installs the most recent version of VirtualBox on Ubuntu.

Install Supporting software

The software-properties-common package is required to run Virtualbox on Ubuntu. It allows you to add new software repositories.

Enter the following into a terminal window:

sudo apt-get install software–properties–common
Install supporting VirtualBox software.

Install GPG keys

GPG keys allow you to verify and communicate with the VirtualBox repository.

To download and install GPG keys, use the commands:

wget –q -O- | sudo apt-key add -
wget -q -O- | sudo apt-key add –
Install GPG keys.

Add VirtualBox Repository to Ubuntu

To add the VirtualBox repository, enter the command :

sudo add-apt-repository "deb bionic contrib"

Note: Bionic Beaver is the codename for Ubuntu 18.04. For other versions, you can replace bionic with the codename for that version of Ubuntu. Find your ubuntu version here.

Install Latest Version of VirtualBox

1. Start by updating the package lists:

sudo apt-get update

2. To Install VirtualBox 6.0 on Ubuntu, use the command:

sudo apt-get install virtualbox–6.0

At the time of writing this article, the latest VirtualBox version is 6.0.8. It was designed for 64-bit operating systems. If you’re running a 32-bit OS, you should use VirtualBox 5.2 instead.

To install VirtualBox 5.2, enter the following:

sudo apt-get install virtualbox–5.2

Install VirtualBox Extension Pack

The VirtualBox Extension Pack enhances the functionality of your virtual machines. It adds additional tools like USB 2.0 and 3.0, Remote Desktop, and encryption.

1. Enter the following:


2. Import the Extension Pack:

sudo VBoxManage extpack install Oracle_VM_VirtualBox_Extension_Pack-6.0.8.vbox-extpack

Confirm the installation, then allow the process to complete.

Note: The Extension Pack corresponds to the version of VirtualBox. If you’re working with VirtualBox 5.2, please see the Version 5.2 downloads page for the Extension Pack.

Using VirtualBox

1. Launch the VirtualBox interface by entering the following:


2. After VirtualBox launches, a graphic interface will load. Use the Add or New button to create a new virtual machine. A dialog will open. Select the operating system and version you’d like to create, then click Next.

3. The dialog will offer you several options for the virtual machine. This is where you allocate memory, hard drive, and other resources to the virtual machine. Use default options if you are unsure about customizing this,

4. Once you finish, a new virtual machine is available in the left column. Select it, and click the green arrow Start button. A new window will open and boot up the virtual machine.

Note: If you need to run a virtual machine from a command line, you can install Vagrant to manage virtual machines from the terminal.


In this tutorial, we covered two methods of installing VirtualBox on Ubuntu. You should now have a working VirtualBox application on your system. For additional information on VirtualBox, visit the VirtualBox Wiki.

And for more tutorials on VirtualBox, be sure to read our guides on How To Install Kali Linux On VirtualBox and How To Install VirtualBox On CentOS 7.

Was this article helpful?
Dejan Tucakov
Dejan is the Head of Content at phoenixNAP with over 7 years of experience in Web publishing and technical writing. Prior to joining PNAP, he was Chief Editor of several websites striving to advocate for emerging technologies. He is dedicated to simplifying complex notions and providing meaningful insight into data center and cloud technology.
Next you should read
How to Install VirtualBox on CentOS 7
September 27, 2019

This guide explains how to install VirtualBox 6.0 on CentOS 7 directly from official Oracle repositories. Get...
Read more
How to Install Kali Linux on VirtualBox
July 14, 2019

Kali Linux is a Debian-derived Linux distribution designed for penetration testing. With over 600...
Read more
How to Install Apache Tomcat 9 on Ubuntu 18.04
July 2, 2019

Apache Tomcat is a free, open-source, lightweight application server used for Java-based web applications.
Read more
How to Install Wine 4 on Ubuntu 18.04
June 5, 2019

Wine is an application that lets you run Windows programs on a Linux system. Wine is similar to an emulator...
Read more
  • © 2021 Copyright phoenixNAP | Global IT Services. All Rights Reserved.