VirtualBox is an open source, cross-platform virtualization manager application. It is owned by Oracle and allows multiple guest operating systems (OS) to run concurrently. VirtualBox supports guest operating systems like Windows, Debian, Fedora, Oracle Linux, Ubuntu, and more.
Your hardware should support and enable hardware virtualization technology to run VirtualBox.
In this tutorial we will learn how to install VirtualBox 6 on Debian 11.
Method 1: Install VirtualBox from the Oracle repository
This is the easiest way to install VirtualBox on Debian from the Oracle repository.
1. Import repository GPG key
2. Add the VirtualBox repository for Debian Bullseye
$ echo "deb [arch=amd64] http://download.virtualbox.org/virtualbox/debian bullseye contrib" | sudo tee /etc/apt/sources.list.d/virtualbox.list
3. Update your Debian system
$ sudo apt update
You can use the apt-cache search virtualbox command to find which package version is available to install.
4. Now run the following commands to install VirtualBox on Debian.
$ sudo apt install linux-headers-$(uname -r) dkms $ sudo apt install virtualbox-6.1
After the installation you can start virtualbox from the terminal, enter the following:
$ virtualbox
Method 2: Install VirtualBox on Debian 11 using Deb Binary
The VirtualBox binary .deb file is available for download from the VirtualBox website.
$ wget https://download.virtualbox.org/virtualbox/6.1.26/virtualbox-6.1_6.1.26-145957~Debian~bullseye_amd64.deb
Once downloaded, install the VirtualBox .deb binary package using the apt command:
$ apt install ./virtualbox-6.1_6.1.26-145957~Debian~bullseye_amd64.deb
Alternatively, you can download .deb through a browser. Then right click on the file and choose Open with another application. Select Install Software and click the Select button. This will open the software installation page and then click the Install button to begin the installation.
Method 3: Install VirtualBox on Debian using the installation script
VirtualBox comes with an installation script to install it on all Linux distributions. Before we run the installation script, we need to install dependencies:
$ sudo apt install wget build-essential python2
Open your browser and go to the official one VirtualBox download Page to get the latest version of VirtualBox.
Right click on All Distributions and copy the link to the installation script.
Open your terminal and via the link we have copied the download installation script as follows:
$ wget https://download.virtualbox.org/virtualbox/6.1.24/VirtualBox-6.1.24-145767-Linux_amd64.run
Next, grant execute permission on the installation file:
$ chmod u+x VirtualBox-6.1.24-145767-Linux_amd64.run
Now run the installation program:
$ sudo ./VirtualBox-6.1.24-145767-Linux_amd64.run
Install the VirtualBox expansion pack
The VirtualBox expansion package is a binary package that extends the functionality of VirtualBox. It offers enhancements such as USB support and host webcam passthrough. It is recommended that you install the VirtualBox expansion pack, the same version as your VirtualBox.
Download the VirtualBox expansion pack for the respective VirtualBox version with wget.
$ wget https://download.virtualbox.org/virtualbox/6.1.24/Oracle_VM_VirtualBox_Extension_Pack-6.1.24.vbox-extpack
You can double-click this file to install the VirtualBox Extension Pack from the desktop or install it through the CLI.
Let’s see how to install it using the CLI.
We use the vboxmanage command to install the VirtualBox expansion pack as follows:
$ sudo vboxmanage extpack install --replace Oracle_VM_VirtualBox_Extension_Pack-6.1.24.vbox-extpack
During the installation you will be asked to accept the Oracle license terms, type y and press Enter:
... the prevailing party shall be entitled to its costs and attorneys' fees actually incurred in connection with such action or proceeding. Do you agree to these license terms and conditions (y/n)?
To allow the current user to run VirtualBox, add to the vboxusers group:
$ sudo usermod -aG vboxusers $(id -un)
Check if the user has been added:
$ id -nG
Output:
linoxide sudo vboxusers
You need to restart your system to make changes:
$ reboot
Verify the installation was successful by checking the version:
$ virtualbox -h
Output:
Oracle VM VirtualBox VM Selector v6.1.26 (C) 2005-2021 Oracle Corporation All rights reserved. No special options. If you are looking for --startvm and related options, you need to use VirtualBoxVM.
You can now enter the virtualbox command with no argument and begin creating virtual machines to host guest operating systems.
diploma
In this tutorial we learned how to install Virtualbox 6 on Debian 11. You now have a running VirtualBox on your Debian system.