Read in 2 minutes
How To Install VirtualBox on Ubuntu 18.04
In this tutorial we’ll show you how to install VirtualBox on a Ubuntu 18.04 machine.
VirtualBox is an open source cross-platform virtualization software which allows you to run multiple guest operating systems (virtual machines) simultaneously.
Before continuing with this tutorial, make sure you are logged in as a user with sudo privileges.
The VirtualBox installation package which is available in the Ubuntu multiverse repository may not always be the latest version. The recommended approach is to install the latest VirtualBox package from the official VirtualBox repositories.
Although this tutorial is written for Ubuntu 18.04 Bionic Beaver the same steps can be used for Ubuntu 16.04 Xenial Xerus.
To install VirtualBox on your Ubuntu system, follow these steps:
Import VirtualBox GPG keys:
First, we need to import the GPG keys of the Oracle VirtualBox repository to our system using the following 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.
Add the VirtualBox repository
Next, add the VirtualBox repository with the
add-apt-repositorycommand as shown bellow:
sudo add-apt-repository "deb 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
Once the VirtualBox repository is enabled, update the
aptpackage list and install the latest version of VirtualBox 5.2 with:
sudo apt update sudo apt virtualbox-5.2
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 have any question, please leave a comment below.