Read in 3 minutes
How To Install VirtualBox on Ubuntu 18.04
VirtualBox is an open source cross-platform virtualization software which allows you to run multiple guest operating systems (virtual machines) simultaneously.
In this tutorial, we will show you two different methods on how to install VirtualBox on your Ubuntu 18.04 machine. The first method describes the steps necessary to install VirtualBox 6.0 from the Oracle repositories while the second one will show you how to install the latest version of VirtualBox from the official Ubuntu repositories.
The VirtualBox package which is available in the Ubuntu multiverse repository may not always be the latest version. If you want to always have the latest version of VirtualBox then the recommended approach is to install the VirtualBox from the Oracle repositories.
The same instructions apply for Ubuntu 16.04 and any Ubuntu-based distribution, including Linux Mint and Elementary OS.
Before continuing with this tutorial, make sure you are logged in as a user with sudo privileges.
Installing VirtualBox from Oracle repositories
At the time of writing this article, the latest version of VirtualBox is version 6.0. Before continuing 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 repositories on your Ubuntu system, follow these steps:
Start by importing the GPG keys of the Oracle VirtualBox repository to your system using the following wget commands:
wget -q https://www.virtualbox.org/download/oracle_vbox_2016.asc -O- | sudo apt-key add - wget -q https://www.virtualbox.org/download/oracle_vbox.asc -O- | sudo apt-key add -
Both commands should output
OKwhich means that the keys are successfully imported and packages from this repository will be considered trusted.
Next, add the VirtualBox repository with the
add-apt-repositorycommand as shown below:
sudo add-apt-repository "deb [arch=amd64] http://download.virtualbox.org/virtualbox/debian $(lsb_release -cs) contrib"
$(lsb_release -cs)will print the Ubuntu codename. For example, if you have Ubuntu version 18.04 the command will print
If you get an error message saying
add-apt-repository command not foundthen you need to install the
Once the VirtualBox repository is enabled, update the
aptpackage list and install the latest version of VirtualBox 6.0 with:
sudo apt update sudo apt install virtualbox-6.0
Installing VirtualBox Extension Pack
The VirtualBox Extension Pack provides several useful functionalities for guest machines such as virtual USB 2.0 and 3.0 devices, support for RDP, images encryption and more.
Download the extension pack file by typing:
When the download is completed 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 presented with the Oracle license and prompted to accept their terms and conditions.
Do you agree to these license terms and conditions (y/n)?
y and hit
Enter. Once the installation is completed you will see the following output:
0%...10%...20%...30%...40%...50%...60%...70%...80%...90%...100% Successfully installed "Oracle VM VirtualBox Extension Pack".
Installing VirtualBox from Ubuntu repositories
Installing VirtualBox from Ubuntu repositories is a pretty straightforward process, just run the following commands:
sudo apt update sudo apt install virtualbox virtualbox-ext-pack
Now that VirtualBox is installed on your Ubuntu system you can start it either from the command line by typing
virtualbox or by clicking on the VirtualBox icon (
Activities -> Oracle VM VirtualBox).
When you start VirtualBox for the first time, a window like the following should appear:
You have learned how to install VirtualBox on your Ubuntu 18.04 machine. You can now install your first Windows or Linux guest machine. To find more information about VirtualBox, visit the official VirtualBox documentation page.
If you’d like to manage your virtual machines from the command line, check out this article on how to How to install Vagrant on Ubuntu 18.04.
If you have any question, please leave a comment below.