Virtualization of operating systems allows users to experience more than one operating system on a physical system. There are several virtualization software used to create virtual machines, one of which is VirtualBox. Usually, it is used for creating Linux-based virtual machines like Debian Ubuntu, Linux Mint, and more. On Debian 12 VirtualBox can be installed in several ways and this guide will discuss all of them
1: Through VirtualBox Deb file
The first method to install VirtualBox on Debian 12 is by using its Debian setup file which you can download from its VirtualBox official website. Furthermore, the benefit or significance of installing any application through its deb file is that most of the time deb file is of the latest version as compared to the repository of any package manager.
Alternatively, the other way around to download the Debian setup file for VirtualBox is by using the file download link along with the wget utility:
wget https://download.virtualbox.org/virtualbox/7.0.18/virtualbox-7.0_7.0.18-162988~Debian~bookworm_amd64.deb
Now there are multiple ways to install an application using is deb file on Debian. Here I have discussed all three in detail one by one:
2:Through Apt Package Manager
The first method to install VirtualBox via its deb file is by using the Debian 12 default package installer, Use the below command for installing Virtualbox on Debian 12:
sudo apt install ./virtualbox-7.0_7.0.18-162988~Debian~bookworm_amd64.deb
To verify the installation of VirtualBox on Debian simply use the app list command along with its name as in the command below:
apt list -a virtualbox-7.0
Now launch the VirtualBox on Debian 12 either by using its application menu or by executing the below terminal command:
virtualbox
3:Through the Debian Software Install App (GUI Method)
Debian-based Linux systems come with a software install application that allows the users to install apps via a deb file. So in the case of VirtualBox, simply open up the file using this software install application. To open the VirtualBox deb file the in Software Install app simply click on the Open With option as in the image below:
Next, a list of possible apps will open, and from there select Software Install and click on Open to proceed:
Next, click on the Install option to begin the installation of Virtualbox on Debian. This method can be used by anyone but it is recommended for new users specifically for new users who are not experts at using Linux commands:
After the VirtualBox is installed on Debian 12 you can launch it by clicking on the Open button:
4: Through Gdebi Package Manager
The last method for installing VirtualBox is by using the Gedebi package installer which uses the application deb files. To install VirtualBox on Debian 12 via Gdebi use the following command:
sudo gdebi virtualbox-7.0_7.0.18-162988~Debian~bookworm_amd64.deb
Now launch the VirtualBox on Debian 12 from its application menu:
One thing to mention here is that you need to install Gdebi first on Debian as it does not come pre-installed on it. So in that case use the below command which will install its command line version:
sudo apt-get install gdebi-core
Note: You might be thinking that most of the time deb files are installed using the dpkg package but in the case of VirtualBox you might be surprised to know that it gives package processing errors. Here is the command that I used for its installation:
sudo dpkg -i ./virtualbox-7.0_7.0.18-162988~Debian~bookworm_amd64.deb
Below are some of the errors that appear while installing VirtualBox on Debian 12 using dpkg package manager:
5: Through the VirtualBox Repository
The second and last method to install VirtualBox on Debian 12 is by adding its repository as the default package manager that does not have a VirtualBox repository. To add the repository in apt first you need to add the GPG keys which will validate the source for a repository for apt and for that execute:
curl -fsSL https://www.virtualbox.org/download/oracle_vbox_2016.asc|sudo gpg --dearmor -o /etc/apt/trusted.gpg.d/vbox.gpg
Next, add the VirtualBox repository in Debian 12 by executing the below command:
echo "deb [arch=amd64] http://download.virtualbox.org/virtualbox/debian $(lsb_release -cs) contrib" | sudo tee /etc/apt/sources.list.d/virtualbox.list
Now to apply the changes in the Apt repository update the packages list by executing:
sudo apt update
Next, use the apt package manager to install VirtualBox on Debian by using the below command:
sudo apt install virtualbox-7.0
To launch VirtualBox on Debian 12 simply search for it in the applications menu or execute the below command in the terminal:
virtualbox
To add the GPG key and VirtualBox repository in Debian you need to install curl and gunpg2 utility which are not pre-installed by default. So to install them execute:
sudo apt install curl gnupg2 -y
Conclusion
To install VirtualBox on Debian 12 there are primarily two ways one is by using its deb file and the other is VirtualBox repository. Further, there are three methods to install Virtualbox on Debian using its deb setup file. These include the apt package manager, software install app, and Gdebi package installer. The recommended way to install VirtualBox on Debian is by using the deb file along with the apt package manager.