VirtualBox is a virtualization software that allows users to run multiple operating systems on a single physical machine. It creates virtual machines (VMs) on which users can install and run different operating systems, such as Windows, Linux, and macOS.
On Debian, VirtualBox is an important tool because it allows users to run a Debian virtual machine on top of their existing operating system. This can be useful for testing, developing, or running software incompatible with the host operating system.
This post will enlist the possible methods to install VirtualBox on Debian, i.e., Debian 11.
Approach#1: How to Install VirtualBox on Debian Using its Repository?
This method will guide you to install VirtualBox on Debian by adding the repository of VirtualBox. The steps are mentioned below:
Step 1: Add VirtualBox Repository
Add the VirtualBox repository to your system by running the following command.
$ echo "deb http://download.virtualbox.org/virtualbox/debian $(lsb_release -sc) contrib" |sudo tee /etc/apt/sources.list.d/virtualbox.list
Step 2: Add Oracle’s GPG Key
Import the Oracle public key for the repository by running the following command.
$ wget -q https://www.virtualbox.org/download/oracle_vbox_2016.asc -O- |sudo apt-key add -
Step 3: Update the Packages List
Run the following command to update the packages list via the following command:
$ sudo apt update
Step 4: Install VirtualBox
Once the Packages list is updated, now, run the following command to install VirtualBox on Debian.
$ sudo apt install virtualbox-7.0
After successfully completing the installation, verify it by launching it from the terminal.
Approach#2: How to Install VirtualBox on Debian Using .deb Package?
The Debian package file of VirtualBox is available on the VirtualBox download page. This section will guide you to download and install the VirtualBox using the .deb package file. The steps carried out are performed below.
Step 1: Download the Package File
Go to the official website and download the Debian package file. When writing this post, the latest version is 7.0.6, whose .deb file can be downloaded via the following command.
For Debian 11:
$ wget https://download.virtualbox.org/virtualbox/7.0.6/virtualbox-7.0_7.0.6-155176~Debian~bullseye_amd64.deb
For Debian 10:
$ wget https://download.virtualbox.org/virtualbox/7.0.6/virtualbox-7.0_7.0.6-155176~Debian~buster_amd64.deb
Step 2: Install the VirtualBox
Once the package file is downloaded, go to the directory where it is downloaded and use the following command to install it.
$ sudo apt install ./virtualbox-7.0_7.0.6-155176~Debian~bullseye_amd64.deb
You can also use the “sudo dpkg -i <packagename>.deb” command to install the VirtualBox.
Once installed, you can launch it from the terminal by writing the following command in the terminal.
Note: If you encounter any dependencies issue, resolve it via the below command.
$ sudo apt install -f
And then again re-run the installation command.
How to Install VirtualBox Extension Pack on Debian?
To enjoy the extended functionality of the VirtualBox, installing the extension pack of your specific VirtualBox version is recommended. This method will guide you in installing the extension pack for version 7.0.6.
Step 1: Download the Extension Pack
The VirtualBox extension pack is platform-independent; the package is the same for all the platforms. You just need to match the version of the VirtualBox installed. We downloaded the extension pack for VirtualBox version 7.0.6 using the command below.
$ wget https://download.virtualbox.org/virtualbox/7.0.6/Oracle_VM_VirtualBox_Extension_Pack-7.0.6.vbox-extpack
Note: Choose the version of the extension pack from the link.
Step 2: Install the Extension Pack
Once downloaded, install it via the following VirtualBox centered command using the command.
$ sudo VBoxManage extpack install Oracle_VM_VirtualBox_Extension_Pack-7.0.6.vbox-extpack
Doing so; you will be able to attach the USB of various supports 2.0, 3.0, and other functionalities such as disk image encryption.
How to Remove VirtualBox From Debian?
The VirtualBox can be removed from the Debian system to offload some load on the system memory as it is virtualization software that consumes many memory resources. Use the command below to remove the package completely:
$ sudo apt autoremove virtualbox-7.0
VirtualBox is the most widely used virtualization software with cross-platform support.VirtualBox can be installed on Debian either by adding its repository or downloading and installing the Debian package file from its official website. For more extended functionality of VirtualBox, it is recommended to install the extension pack, whose installation is also described in this post.