How to Install VirtualBox on Debian Linux 9

Updated on

3 min read

Install VirtualBox on Debian 9

VirtualBox is an open-source cross-platform virtualization software which allows you to run multiple guest operating systems (virtual machines) simultaneously.

This tutorial covers how to install the latest VirtualBox 6.0 on Debian 9.

Prerequisites

You’ll need to be logged in as a user with sudo access to be able to install packages on your Debian system.

Installing VirtualBox from Oracle repositories

Starting with Debian 9, VirtualBox packages are not available in the officials Debian repositories. We’ll be installing VirtualBox from the 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.

Installing VirtualBox on Debian Linux is a relatively straightforward process and will only take a few minutes:

  1. 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 OK which means that the keys are successfully imported and packages from this repository will be considered trusted.

  2. Next, add the VirtualBox repository to your sources list:

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

    $(lsb_release -cs) will print the Debian codename. In our case, that is stretch.

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

  3. Once the VirtualBox repository is enabled, update the apt package list and install the latest version of VirtualBox 6.0 with:

    sudo apt update && sudo apt install virtualbox-6.0

At this point, VirtualBox is installed and ready to be used.

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 with wget :

wget https://download.virtualbox.org/virtualbox/6.0.0/Oracle_VM_VirtualBox_Extension_Pack-6.0.0.vbox-extpack
Ensure that the version of the Extension Pack matches with the VirtualBox version.

Once the download is completed run the following command to install the extension pack:

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)?

Type 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".

Starting VirtualBox

Now that VirtualBox is installed on your Debian system you can start it either from the command line by typing:

virtualbox

Or if you are using Xfce as your desktop environment clicking on the VirtualBox icon (Applications -> System -> Oracle VM VirtualBox).

When you start VirtualBox for the first time, a window like the following should appear:

Debian Install Virtualbox

If your are using KDE, launch VirtualBox by clicking on the VirtualBox icon KDE menu -> System -> Oracle VM VirtualBox.

GNOME users can start VirtualBox by clicking on the VirtualBox icon: Applications -> System Tools -> Oracle VM VirtualBox.

Conclusion

You have learned how to install VirtualBox on your Debian 9 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 questions, please leave a comment below.