VirtualBox Software on Debian or any other Linux is meant to provide a powerful virtualization platform. It allows users to run multiple operating systems as a guest on your current system without any modification. This implies even if you are using a Linux distro can run Windows on it just like any other software application. VBox is a cross-platform application developed by Oracle. So, either run multiple operating systems on a single physical machine or legacy Windows applications or set up virtual development environments using this valuable tool for virtualization. In this tutorial, we see the steps and commands needed for installing VirtualBox on Debian.
There are a few things you must have to follow this tutorial:
- Ofcourse a Debian 12 or any other Debian-based distributions such as Ubuntu.
- Administrative (sudo) privileges.
- A working internet connection.
Step 1: Update Debian Package Repository
If you are planning to install VirtualBox then you would be using GUI-based Debian desktop Linux. So, open your command terminal by searching for it in the Applications. After that, run the system update command to ensure all the packages are up to date.
sudo apt update && sudo apt upgrade -y
Step 2: Install dkms package
There are some dependencies, that should be on your system such as the DKMS package which is essential for managing VirtualBox kernel modules during kernel updates. So, run:
sudo apt install gcc make linux-headers-$(uname -r) dkms
Step 3: Add Oracle VirtualBox public key
Before adding the repository of VirtualBox, add the GPG key that will help the system to confirm the packages we are getting to install this software are as they were released by its developers and not have been modified by someone else in between.
wget -O- https://www.virtualbox.org/download/oracle_vbox_2016.asc | sudo gpg --dearmor --yes --output /usr/share/keyrings/oracle-virtualbox-2016.gpg
Step 4: Add the Repository
The next step is to add the repository using the given command. It will help us to always download and install the up-to-date VirtualBox version available for Debian 12 Linux. In the given command we are also assigning the GPG key downloaded in the previous command to the repository we are adding.
sudo sh -c 'echo "deb [arch=amd64 signed-by=/usr/share/keyrings/oracle-virtualbox-2016.gpg] https://download.virtualbox.org/virtualbox/debian $(lsb_release -sc) contrib" > /etc/apt/sources.list.d/virtualbox.list'
Step 5: Installing VirtualBox on Debian 12
All the necessary things required to install VirtualBox on Debian 12 are now configured properly, it’s time to run the main command to get this open-source virtualization software on our system.
sudo apt update
Currently while writing this tutorial two versions of VirtualBox – 7.0 and 6.0 are available to install through the added repo.
To check their availability you can use:
sudo apt search virtualbox
For example, if you want to install the latest 7.0 version, then the command will be:
sudo apt install virtualbox-7.0
Step 7: Install the VirtualBox Extension Pack
To enable extra features on the VirtualBox such as USB 3.0/2.0 support including VRDP, disk encryption, NVMe and PXE boot for Intel cards, and more; install the Extension Pack.
Step 1: Download the extension package (use this Link)
Step 2: Click on the “All supported platforms” link.
Step 3: Open VirtualBox and press Ctrl+T
Step 4: Click on the Install icon and select the downloaded “VirtualBox extension pack”
Apart from that you can also install VirtualBox Guest-additions ISO on Debian 12 to enable the drag-drop & clipboard support between host and guest.
sudo apt install virtualbox-guest-additions-iso
Now you have VirtualBox installed and ready to use on your Debian-based system for a wide range of tasks, including testing new operating systems, developing and testing software, and more.