Install VirtualBox in Debian Stretch

Published: June 19, 2019

Install VirtualBox in Debian Stretch

VirtualBox is a free and open-source virtualization product developed by Oracle Corporation. It was first released on January 17, 2007. With VirtualBox, we can create Virtual Machines. These Virtual Machines can then run on our host operating systems. Apart from that, we can use VirtualBox extension packs for extra functionality like for USB devices, Remote desktop protocol support, Webcam support, PXE boot ROM etc. VirtualBox Guest Additions are also available. In this article, we would discuss how to install VirtualBox in Debian Stretch.

Benefits of using a Virtual Machine

  1. For testing purposes: If we are testing a product on our main Operating system. And, if something goes wrong then we could get a broken Operating system. There are two options available to us then, either we fix or reinstall it. To save the effort, we can use Virtual Machines. In that scenario, only our Virtual Machines are affected and that too could be fixed in few seconds if we have already taken its screenshots.
  2. Run Multiple Operating Systems: We could run multiple operating systems at a time using Virtual Machines. Also, it could be possible that there may be certain operating systems that may not be supported by our hardware. We can also run those operating systems through Virtual Machines.
  3. Reduces costs on Infrastructure: We do not have to purchase separate hardware for running multiple operating systems. We could do tasks using operating systems installed on Virtual Machines and that in turn would help us reduce costs in infrastructure expenses.

Install VirtualBox in Debian Stretch

First, open terminal and login as root/superuser by:

su -l

if you don't have the privileges then contact your system administrator.

Now, download the .deb package (virtualbox-6.0_6.0.14-133895~Debian~stretch_amd64.deb) from the official website of VirtualBox. This is the latest stable release available at the time of writing the article.

We would now install the package through dpkg (Debian Package Manager). Once the package gets downloaded, head to the directory where it is saved through cd command-line utility.

cd /path/to/package/
dpkg -i virtualbox-6.0_6.0.14-133895~Debian~stretch_amd64.deb

We may encounter following error –

The distribution packages containing the headers are probably:
linux-headers-amd64 linux-headers-X.XX.X-X-amd64

Under such a scenario, we need to install relevant packages –

apt install linux-headers-amd64 linux-headers-X.XX.X-X-amd64


X – replace it with applicable version number.

Now, again we need to issue the following to complete the installation process (if you didn’t get the error, then this step isn’t required) –

dpkg -i virtualbox-6.0_6.0.14-133895~Debian~stretch_amd64.deb

In conclusion, we have discussed how to install VirtualBox in Debian stretch, which is the latest stable release at the time of writing the article.