Virtual machines come quite handy when you are developing software: they allow you to create different testing/developing environments that can be easily backed up, and most important if you manage to completely mess up your system –  and yes, from times to times that sadly happens – you limit the damage to a single environment.

It also allows you to play with differents O.S.

Therefore I usually have a Virtual machine player installed in my system: usually VMware in Windows, and Virtual Box in Linux.

You can get VirtualBox  quite easily from the Debian repositories, but if you that you are unlikely to get the most recent version, therefore we are going to use the VirtualBox official repository.

That is quite easy, you only need to follow the instructions at the VirtualBox official site:

Open a console  as root an add the official VirtualBox repository and add this entry to your /etc/apt/sources.list:

deb stretch contrib

Download the oracle public key for the Stretch repository, and install it using this command:

apt-key add oracle_vbox_2016.asc

Install VirtualBox:

apt-get update
apt-get install virtualbox-6.0

Now, the first time I tried to install Oracle’s virtual box in my Debian Stretch box following the instructions above, I run into a little set up that I though I would document here just in case someone else stumbles across it.

When I tried to do an apt-get install virtualbox-6.0 the system said that there was no such package available. After checking the output of apt-get update I noticed this message ins the command line:

Hit:1 stretch/updates InRelease
Ign:2 stretch InRelease
Hit:3 stretch-updates InRelease
Hit:4 stretch Release
Reading package lists... Done
E: The method driver /usr/lib/apt/methods/https could not be found.
N: Is the package apt-transport-https installed?
E: Failed to fetch
E: Some index files failed to download. They have been ignored, or old ones used instead.

IN the message above are both the reason of the problem and its solution. Run this command:

apt-get install apt-transport-https

An then try again installing the virtual machine:

apt-get update
apt-get install virtualbox-6.0

Now it installs without a hitch 🙂