Install VirtualBox on Debian: Step by Step Guide

VirtualBox is a powerful, free, and open-source virtualization software that allows you to run multiple operating systems simultaneously on a single machine. Whether you need to test software in different environments, run legacy applications, or experiment with new operating systems, VirtualBox provides a reliable solution. This guide will walk you through installing the latest version of VirtualBox on Debian Linux using the official Oracle repository.

In this tutorial you will learn:

  • How to add VirtualBox repository to Debian
  • How to install VirtualBox 7.2 on Debian
Install VirtualBox on Debian: Step by Step Guide
Install VirtualBox on Debian: Step by Step Guide
Software Requirements and Linux Command Line Conventions
Category Requirements, Conventions or Software Version Used
System Debian 12 (Bookworm) or higher
Software VirtualBox 7.2 or higher
Other Privileged access to your Debian system
Conventions # – requires given linux commands to be executed with root privileges either directly as a root user or by use of sudo command
$ – requires given linux commands to be executed as a regular non-privileged user

Install VirtualBox on Debian

  1. Switch to root user: Become root to execute administrative commands
    $ su -

    INSTALLATION TIPS
    If sudo is available on your system, you can use sudo for each command instead. Otherwise, switch to root user with su – and enter your root password when prompted

  2. Install wget: Install wget utility if not already present on your system
    # apt install wget

    The wget tool is required to download the VirtualBox repository key

  3. Add VirtualBox GPG key: Download and install the Oracle VirtualBox repository signing key to verify package authenticity
    # wget -O- https://www.virtualbox.org/download/oracle_vbox_2016.asc | gpg --dearmor --yes --output /usr/share/keyrings/oracle-virtualbox-2016.gpg

    This command downloads the Oracle public key and saves it to the system keyring directory

  4. Add VirtualBox repository: Add the official VirtualBox repository to your system’s sources list
    # echo "deb [arch=amd64 signed-by=/usr/share/keyrings/oracle-virtualbox-2016.gpg] https://download.virtualbox.org/virtualbox/debian $(lsb_release -cs) contrib" | tee /etc/apt/sources.list.d/virtualbox.list

    The $(lsb_release -cs) command automatically detects your Debian version codename (bookworm, trixie, etc.)

  5. Update package list: Refresh your system’s package database to include VirtualBox packages
    # apt update

    This ensures your system recognizes the newly added VirtualBox repository

  6. List available VirtualBox versions: Check which VirtualBox versions are available for installation
    # apt-cache search virtualbox | grep ^virtualbox

    This command displays all available VirtualBox packages, allowing you to choose your preferred version

    List available VirtualBox versions
    List available VirtualBox versions
  7. Install VirtualBox: Install your chosen VirtualBox version from the official repository
    # apt install virtualbox-7.2

    Replace 7.2 with your preferred version from the previous step. The installation will complete with all necessary dependencies automatically resolved

Conclusion

You have successfully installed VirtualBox 7.2 on your Debian system. You can now launch VirtualBox from your applications menu or by running virtualbox command in the terminal to start creating and managing virtual machines.