Here’s a simple guide for you to install VirtualBox on Debian Linux (all versions).
VirtualBox is a very popular virtualisation application with several advanced features and controls for your virtual machines. You can dynamically allocate virtual machine storage, USB, networking and other critical parameters. Other free and open-source virtual machine apps are available such as virt-manager, and GNOME Boxes, which are equally good for average use cases. However, VirtualBox is easy to use and comes with advanced options. Remember, it is free to use but is a closed-source application from Oracle.
In prior articles, I explained how to install it in other distributions, such as Fedora and RHEL. This article outlines the steps to install it in Debian Linux.
It is tested in Debian 11 “bullseye” stable. However, it should be applicable for all versions and variants.
Table of Contents
Install Oracle VirtualBox in Debian Linux
VirtualBox 7.0+ requires several Qt5 dependencies and associated packages to build kernel modules. These are not needed for installation. But if you want to enable copy/paste between guest or host machines and other tweaks, these are needed. I would recommend you install these first.
First, open a terminal and install the following packages. These are necessary to build the kernel modules.
sudo apt install gcc make perl linux-headers-generic
Download the DEB package for your system’s Debian version from the link below. Remember to choose a specific installer for your Debian version (how to find version?).
Once downloaded, go to the downloaded folder (usually
~/Downloads) and run the following. Make sure you change the file name as per the file you downloaded.
sudo dpkg -i virtualbox-7.0_7.0.6-155176~Debian~bullseye_amd64.deb
The above command is likely to cause a dependency error.
If it does, run the following. Don’t try to install the dependent packages separately by yourself; let
apt take care of it.
sudo apt --fix-broken install
The above command will install the following dependencies for Virtualbox.
And finally, it will resume the installation and finishes it.
Add user is added to vboxusers group
After completion, you need to make sure that your username is added to vboxusers group. The installer creates this group.
Open a terminal and run the following to check if you are added to
vboxusers group. Change the username from “arindam” to your user.
Then, get into a super user shell with root path concatenations using the below command. This is needed if the user is not added to sudoers group.
Then run the following to add the user to vboxusers group.
usermod -a -G vboxusers arindam
Leave the root shell with exit and verify whether you are added to the group.
This concludes the VirtualBox install in Debian Linux. You can now launch VirtualBox from the Debian application menu.
Since you are ready to use it, installing VirtualBox guest additions in Debian Linux is the ideal next step.
But make sure you have a Virtual machine (such as Fedora, Ubuntu, etc.) installed in VirtualBox before trying it out. To demonstrate, I have installed Ubuntu as a guest in the Debian Linux host. And now I am going to install guest additions. You may refer to this simple guide on how to install Ubuntu in Virtualbox as guest.
Install VirtualBox guest additions in Debian Linux
Oracle’s VirtualBox guest additions provide a set of device drivers and apps that helps achieve data and other communication between the guest and host system. For example, if you want to share folders, drag and drop from host to guest. Here are some of the cool features of Guest Additions.
- Share folders
- Drag and drop feature
- Bi-directional clipboard to achieve seamless cut/copy & paste
- Better video performance
As you can see, it’s essential that you install it after VirtualBox installation.
Launch the virtual machine in VirtualBox. Then from the VirtualBox menu, select “insert guest additions CD image…”.
Open the file manager and go into the mounted drive for guest additions. And run the following script to install it.
After the above command is complete, reboot your guest system.
And you can now enable copy/paste and other guest additions features.
Uninstall, re-install and upgrade
If you want to uninstall and reinstall, then you can run the following command to uninstall. Make sure to change the version accordingly in the below command.
sudo apt remove virtualbox-7.0
In addition, if you want to upgrade to the latest version, uninstall it first. Then re-install using the above methods with a fresh download.
All your created VM and its data are kept during the upgrade. So, you can get all of your VMs created in the prior version. Ideally, they are kept at
~./VirtualBox VMs in your home directory.
This guide taught you how to install Oracle VirtualBox in Debian easily. The steps are tested in Debian 11 Bullseye. I hope it helps. Let me know if you run into any errors in the comment box below.