How to Install VirtualBox on Debian 9 Stretch

VirtualBox is a free and open-source virtualization software that can run on Linux, Mac, Windows and Solaris. For some reason, it isn’t included in the Debian 9 repository. This tutorial shows how to install VirtualBox on Debian 9 Stretch.

How to Install VirtualBox on Debian 9 Stretch

At the time of this writing, the latest stable version of VirtualBox is 5.1.22, released on April 28th, 2017. To install VirtualBox on Debian 9, we will have to use the official Oracle repository.

Open up a terminal window and run the command below to switch to the root user.

su -

Then run the following command to create a source list file for the official VirtualBox repository. nano is a beginner-friendly command-line text editor.

nano /etc/apt/sources.list.d/virtualbox.list

install virtualbox on debian 9 stretch

You will be presented with the nano text editor. Add the following line into the file.

deb http://download.virtualbox.org/virtualbox/debian stretch contrib

debian 9 virtualbox

To save the file with nano text editor, you need to press CTRL+O, then press Enter. To exit nano text editor, press CTRL+X. Next, we need to download and import the Oracle GPG public key to Debian 9 system with the following command.

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

The public key allows APT package manager to verify the integrity of downloaded packages. Then all left to do is update local package index and install Virtualbox 5.1.

apt update

apt install virtualbox-5.1

debian stretch virtualbox

Once it’s installed, start it from your application menu, or run the command below to start VirtualBox from terminal.

virtualbox

You can check the version number in help > about VirtualBox.

debiain 9 strectch virtualbox

To ensure that the VirtualBox host kernel modules (vboxdrv, vboxnetflt and vboxnetadp) are properly updated if the linux kernel version changes during the next apt upgrade, install the dkms package.

apt install dkms

That’s it! I hope this tutorial helped you install VirtualBox on Debian 9 Stretch.

Rate this tutorial
[Total: 8 Average: 4]