Table of Contents

Ubuntu - Virtual Machine - Install VirtualBox

VirtualBox is an excellent virtualization tool, specially for desktop operating systems.


Import the GPG keys of the Oracle VirtualBox repository

sudo 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 -

Add the VirtualBox APT repository

sudo add-apt-repository "deb [arch=amd64] http://download.virtualbox.org/virtualbox/debian $(lsb_release -cs) contrib"

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

sudo apt install software-properties-common

INFO: $(lsb_release -cs) prints the Ubuntu codename.

For example, if you have Ubuntu version 18.04 the command will print bionic.


Update the apt package list

sudo apt update

Install the latest version of VirtualBox

sudo apt install virtualbox-6.1

TIP: A good idea would be to type

sudo apt install virtualbox–

and hit tab to see the various VirtualBox versions available for installation.

This would display something like:

virtualbox-5.1                  virtualbox-6.0                  virtualbox-dkms                 virtualbox-guest-additions-iso  virtualbox-guest-dkms-hwe       virtualbox-guest-source-hwe     virtualbox-guest-utils-hwe      virtualbox-guest-x11-hwe        virtualbox-source               
virtualbox-5.2                  virtualbox-6.1                  virtualbox-ext-pack             virtualbox-guest-dkms           virtualbox-guest-source         virtualbox-guest-utils          virtualbox-guest-x11            virtualbox-qt        

Then select one of them by typing it completely.


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.

sudo apt install virtualbox-ext-pack