How To Install Virtualbox on Ubuntu 18.04

In this tutorial we learn how to install VirtualBox on Ubuntu 18.04. We will learn the installation of VirtualBox package from Ubuntu repository and from Oracle repository

How To Install Virtualbox on Ubuntu 18.04

In this tutorial we learn how to install Virtualbox on Ubuntu 18.04.

Virtualbox is a virtualization for x86 and AMD64/Intel64. Initially created by Innotek which was acquired by SUN Microsystem in 2008. In 2010, SUN Microsystem was acquired by Oracle.

Some features of Virtualbox including:

  • Portability
  • Guest Additions: shared folders, seamless windows, 3D virtualization.
  • Great hardware support including guest multiprocessor (SMP), USB device support, hardware compatibility, Full ACPI Support, Multi Screen resolutions, Built-in iSCSI support, and PXE Network Boot
  • Multigeneration branched snapshots.
  • VM groups
  • Clean architecture and unprecedented modularity.
  • Remote machine display

There are two source of installing Virtualbox on Ubuntu 18.04.

  • From Ubuntu official repository
  • From Oracle Virtualbox repository

We will learn how to install Virtualbox from each repository above. You just have to follow one of method described below

Install Virtualbox From Ubuntu Repository

Update apt database

Before installing Oracle Virtualbox from Ubuntu repository, let’s update our systems’ apt database using the command below.

sudo apt-get update

After updating our systems apt database we can install virtualbox using the command below.

sudo apt install virtualbox virtualbox-ext-pack

Press y to continue the installation process.

We just finished installing Virtualbox from Ubuntu repository.

In the next section we will learn how to install Virtualbox from Oracle repository.

Install Virtualbox From Oracle repository

In this section we learn how to install Virtualbox from Oracle repository.

Add Virtualbox GPG Key

First, we need to add Virtualbox GPG key. This will be used by apt to verify whether the package we download is a correct package which was created by Virtualbox developers.

wget -q https://www.virtualbox.org/download/oracle_vbox_2016.asc -O- | sudo apt-key add -

Create Virtualbox Repository Configuration

After adding Virtualbox GPG key, now we will create new file /etc/apt/sources.list.d/virtualbox.list using the command below.

echo "deb [arch=amd64] https://download.virtualbox.org/virtualbox/debian bionic contrib" | sudo tee /etc/apt/sources.list.d/virtualbox.list >> /dev/null

Update apt Metadata

GPG key and repository configuration created. Now it’s time to update our apt database / metadata using the command below.

sudo apt-get update

Install Virtualbox on Ubuntu 18.04

Everything is ready, it’s time to install Virtualbox on Ubuntu 18.04 using the command below.

sudo apt-get install virtualbox

Press y to continue the installation process.

Install VirtualBox Extension Pack

VirtualBox Extension Pack provides several useful functionalities for guest machines such as virtual USB 2.0 and 3.0, support for RDP, images encryption and more.

First let’s download the VirtualBox Extension pack file using the command below.

wget https://download.virtualbox.org/virtualbox/6.1.22/Oracle_VM_VirtualBox_Extension_Pack-6.1.22.vbox-extpack

Install VirtualBox Extension Pack using the command below.

sudo VBoxManage extpack install Oracle_VM_VirtualBox_Extension_Pack-6.1.22.vbox-extpack
Do you agree to these license terms and conditions (y/n)?

Press y to continue the installation process

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

Oracle VM VirtualBox Extension successfully installed.

Starting Oracle VirtualBox

To start VirtualBox, you can type virtualbox from terminal.

Alternatively you can click on VirtualBox icon on Activities -> Virtualbox

Further References

To learn more about VirtualBox, you can read VirtualBox Documentation.

Summary

In this tutorial we learn how to install VirtualBox from Ubuntu Repository and Oracle Repository.

The VirtualBox version from Oracle Repository should provide you with the latest version of Oracle VirtualBox.

When installing Oracle VirtualBox from Oracle repository, you have to manually install Extension pack by downloading the extension pack and run vboxmanage command.