How To Install VirtualBox on Debian 12

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.

Directly downloading Virtual Box deb file on Debian 12

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

Downloading Virtual Box deb file on Debian 12 using download link in terminal

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

verifying the installation of Virtual Box on Debian

Now launch the VirtualBox on Debian 12 either by using its application menu or by executing the below terminal command:

virtualbox

Launching Virtual Box on Debian using virtualbox command

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:

Opening virtual box deb file in Debian 12

Next, a list of possible apps will open, and from there select Software Install and click on Open to proceed:

Opening virtual box deb file on Debian 12 using software install application.

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:

Installing Virtual Box using its deb file through software install app on Debian 12

After the VirtualBox is installed on Debian 12 you can launch it by clicking on the Open button:

Launching Virtual Box on Debian using Software Install app

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

installing VirtualBox on Debian 12 using its deb file through Gdebi package manager

Now launch the VirtualBox on Debian 12 from its application menu:

lauching VirtualBox in Debian 12 through 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:

Package processing error for installing VirtualBox on Debian 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

Adding GPG key for VirtualBox repository in Debian 12

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

Adding VirtualBox repository on Debian 12

Now to apply the changes in the Apt repository update the packages list by executing:

sudo apt update

Updating the packages lists for Debian apt package manager

Next, use the apt package manager to install VirtualBox on Debian by using the below command:

sudo apt install virtualbox-7.0

installing VirtualBox iun Debian using apt package manager

To launch VirtualBox on Debian 12 simply search for it in the applications menu or execute the below command in the terminal:

virtualbox

Launching Virtual Box on Debian 12 using virtualbox command

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

Installing Gnupg2 and curl utility on Debian for VirtualBox.

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.

 

Index
Scroll to Top