How to Install VirtualBox on Ubuntu 26.04, 24.04 and 22.04

Install VirtualBox on Ubuntu 26.04, 24.04, and 22.04 with Oracle APT for the current upstream branch, or use Ubuntu multiverse packages when you prefer distro-managed builds. Includes keyring setup, service checks, Extension Pack handling, updates, troubleshooting, and removal.

Last updatedAuthorJoshua JamesRead time8 minGuide typeUbuntu

To install VirtualBox on Ubuntu 26.04, 24.04, or 22.04, use Oracle’s official APT repository when you want the current Oracle VirtualBox 7.2 branch with normal APT updates. Oracle now publishes repository metadata for resolute, noble, and jammy on amd64 hosts, while Ubuntu’s multiverse packages remain the distro-maintained alternative.

The workflow below checks your Ubuntu release, adds Oracle’s signed repository with a codename guard, installs VirtualBox with matching kernel headers, verifies the kernel service, adds your account to the vboxusers group, and covers Extension Pack, Guest Additions, updates, troubleshooting, and removal.

This article installs VirtualBox on an Ubuntu host. If your search was how to install Ubuntu on VirtualBox, install VirtualBox first, then create a new VM and attach the Ubuntu ISO as the guest installer.

Choose a VirtualBox Package Source on Ubuntu

Start by confirming your Ubuntu release. The codename decides which repository suite your system should use:

lsb_release -ds
lsb_release -cs

Use Oracle’s repository for the current upstream VirtualBox branch and APT-managed updates. Ubuntu’s own packages are useful when you prefer distro-maintained builds, but they can lag behind Oracle’s current branch on older Ubuntu releases.

Package SourceSupported Ubuntu ReleasesPackage PathBest Fit
Oracle official APT repositoryUbuntu 26.04, 24.04, and 22.04 LTSvirtualbox-7.2Best choice for the current Oracle build with normal APT updates.
Ubuntu multiverse repositoryUbuntu 26.04, 24.04, and 22.04 LTSvirtualbox and virtualbox-qtUse when you prefer Ubuntu-maintained packages over Oracle’s upstream packages.
Oracle direct .deb downloadUbuntu 26.04, 24.04, and 22.04 LTSvirtualbox-7.2_*.debUse only for one-off or offline installs because it does not add a managed repository.

Oracle’s Ubuntu host packages are amd64 packages. Do not point one Ubuntu release at another release’s Oracle suite; use resolute for Ubuntu 26.04, noble for Ubuntu 24.04, and jammy for Ubuntu 22.04.

Install VirtualBox from Oracle’s APT Repository

Oracle’s APT repository is the cleanest official VirtualBox download path for Ubuntu 26.04, 24.04, and 22.04. If you are trying to download VirtualBox for Ubuntu 24.04 or a newer supported Ubuntu release, this repository method is safer than a one-off .deb download because APT keeps the package updated. It uses the same Oracle package family shown on the VirtualBox Linux Downloads page, but keeps future updates inside normal apt upgrade maintenance.

Update Ubuntu and Install Repository Tools

Refresh your package list and install the tools needed for Oracle’s signed repository and VirtualBox kernel modules:

sudo apt update
sudo apt install curl ca-certificates gpg lsb-release build-essential dkms "linux-headers-$(uname -r)"

If your account cannot run sudo, add a new user to sudoers on Ubuntu first, then return to this installation. The gpg package converts Oracle’s signing key to a binary keyring, lsb-release supplies the release codename, and the build tools let DKMS build VirtualBox modules for your running kernel.

Import Oracle’s VirtualBox Signing Key

Download Oracle’s VirtualBox archive signing key and confirm its fingerprint before installing the APT keyring:

ORACLE_VBOX_KEY_TMP=$(mktemp -d)
curl -fsSLo "$ORACLE_VBOX_KEY_TMP/oracle_vbox_2016.asc" https://www.virtualbox.org/download/oracle_vbox_2016.asc
gpg --homedir "$ORACLE_VBOX_KEY_TMP" --show-keys --with-fingerprint "$ORACLE_VBOX_KEY_TMP/oracle_vbox_2016.asc"

The fingerprint should match Oracle’s VirtualBox archive signing key:

B9F8 D658 297A F3EF C18D  5CDF A2F6 83C5 2980 AECF

Convert the key and install it into the system keyring path used by the repository file:

gpg --homedir "$ORACLE_VBOX_KEY_TMP" --dearmor --yes \
  -o "$ORACLE_VBOX_KEY_TMP/oracle-virtualbox-2016.gpg" \
  "$ORACLE_VBOX_KEY_TMP/oracle_vbox_2016.asc"
sudo install -m 0644 "$ORACLE_VBOX_KEY_TMP/oracle-virtualbox-2016.gpg" /usr/share/keyrings/oracle-virtualbox-2016.gpg
rm -rf "$ORACLE_VBOX_KEY_TMP"

Add the Oracle VirtualBox Repository

Create the Oracle repository file only on supported Ubuntu codenames. The check below allows resolute, noble, and jammy, then prints a clear message on any unsupported release:

UBUNTU_CODENAME=$(lsb_release -cs)

if [ "$UBUNTU_CODENAME" = "resolute" ] || [ "$UBUNTU_CODENAME" = "noble" ] || [ "$UBUNTU_CODENAME" = "jammy" ]; then
  cat <<EOF | sudo tee /etc/apt/sources.list.d/oracle-virtualbox.sources
Types: deb
URIs: https://download.virtualbox.org/virtualbox/debian
Suites: $UBUNTU_CODENAME
Components: contrib
Architectures: amd64
Signed-By: /usr/share/keyrings/oracle-virtualbox-2016.gpg
EOF
else
  echo "Oracle's VirtualBox repository is not validated for $UBUNTU_CODENAME in this guide."
  echo "Use Ubuntu's multiverse package or check Oracle's Linux downloads page for current support."
fi

Refresh APT again so Ubuntu can see the Oracle package metadata:

sudo apt update

Install VirtualBox 7.2 from Oracle

Install VirtualBox 7.2 from Oracle. The build tools and kernel headers were installed earlier so DKMS can build the host modules:

sudo apt install virtualbox-7.2

Oracle also publishes older virtualbox-7.1 and virtualbox-7.0 packages for compatibility cases. Use virtualbox-7.2 unless you already know a VM, extension, or workflow requires an older branch.

Confirm that VirtualBox came from Oracle’s repository rather than Ubuntu’s default repository:

apt-cache policy virtualbox-7.2

Relevant output shows your Ubuntu codename under Oracle’s contrib component. Ubuntu 26.04 uses resolute/contrib, Ubuntu 24.04 uses noble/contrib, and Ubuntu 22.04 uses jammy/contrib. The exact maintenance build changes as Oracle updates VirtualBox:

        500 https://download.virtualbox.org/virtualbox/debian resolute/contrib amd64 Packages
        100 /var/lib/dpkg/status

The important checks are the virtualbox-7.2 package name and the download.virtualbox.org source.

Use Ubuntu’s Multiverse Package Instead

If you prefer Ubuntu-maintained packages over Oracle’s upstream packages, install VirtualBox from Ubuntu’s multiverse repository instead. This method uses Ubuntu’s package versions and service layout, so do not mix it with the Oracle repository package on the same host.

sudo apt update
sudo apt install virtualbox virtualbox-qt virtualbox-dkms "linux-headers-$(uname -r)"

Verify that APT selected Ubuntu’s package source:

apt-cache policy virtualbox

Relevant output includes an Ubuntu source such as resolute/multiverse, noble-updates/multiverse, or jammy-updates/multiverse instead of download.virtualbox.org:

        500 http://archive.ubuntu.com/ubuntu resolute/multiverse amd64 Packages
        100 /var/lib/dpkg/status

Configure VirtualBox on Ubuntu

Check the VirtualBox Kernel Service

VirtualBox uses kernel modules such as vboxdrv, vboxnetflt, and vboxnetadp. The service name depends on the package source, so use the command that matches your install method.

For Oracle’s virtualbox-7.2 package on Ubuntu 26.04, 24.04, or 22.04, check vboxdrv.service:

systemctl status vboxdrv

A working Oracle package service reports active (exited):

vboxdrv.service - VirtualBox Linux kernel module
     Loaded: loaded (/usr/lib/virtualbox/vboxdrv.sh; enabled; preset: enabled)
     Active: active (exited)

If you installed Ubuntu’s multiverse package instead, check virtualbox.service:

systemctl status virtualbox

A working Ubuntu package service also reports active (exited):

virtualbox.service - Virtualbox kernel modules
     Loaded: loaded (/usr/lib/systemd/system/virtualbox.service; enabled; preset: enabled)
     Active: active (exited)

If Secure Boot is enabled and VirtualBox reports unsigned-module or verification errors, check mokutil --sb-state and follow Ubuntu’s DKMS/MOK enrollment prompt after the next reboot. After enrollment, rerun the matching service-status command.

Enable the VirtualBox Service if Needed

If the matching service is installed but inactive, start it and enable it for future boots. Use this command for Oracle’s package:

sudo systemctl enable vboxdrv --now

Use this command for Ubuntu’s multiverse package:

sudo systemctl enable virtualbox --now

For broader service inspection and enable/start syntax, use these systemctl command examples before changing other units.

Add Your User to the vboxusers Group

Add your account to the vboxusers group before using USB passthrough, host-only adapters, and other hardware-backed features. The -aG flags append the group without replacing your existing supplementary groups:

sudo usermod -aG vboxusers "$USER"

Log out and back in, or reboot, then confirm the new group appears:

groups "$USER"
username : username adm cdrom sudo dip plugdev lpadmin vboxusers

Launch VirtualBox on Ubuntu

Launch VirtualBox from the terminal with this command:

virtualbox

You can also open it from your desktop application menu as Oracle VM VirtualBox or VirtualBox, depending on the package source.

Install VirtualBox Extension Pack on Ubuntu

The VirtualBox Extension Pack is optional and distributed under Oracle’s Personal Use and Evaluation License. Install it only when you need USB 2.0 or USB 3.0 passthrough, VirtualBox RDP, disk encryption, NVMe support, PXE boot features, or similar proprietary extras. The Extension Pack version must match the installed VirtualBox version.

If you installed Ubuntu’s multiverse virtualbox package and want Ubuntu to manage the Extension Pack, install Ubuntu’s matching wrapper package instead of the manual Oracle download. Do not use virtualbox-ext-pack with Oracle’s virtualbox-7.2 package because the package versions can diverge.

sudo apt install virtualbox-ext-pack

For Oracle’s virtualbox-7.2 package, detect the installed VirtualBox version first. Oracle builds usually report a value such as 7.2.12r174389:

VBOX_VERSION=$(VBoxManage -v | sed -E 's/[_r].*$//')
echo "$VBOX_VERSION"

Download the matching Extension Pack and Oracle’s checksum file:

BASE_URL="https://download.virtualbox.org/virtualbox/${VBOX_VERSION}"
EXTPACK="Oracle_VirtualBox_Extension_Pack-${VBOX_VERSION}.vbox-extpack"

if ! curl -fLO "${BASE_URL}/${EXTPACK}"; then
  EXTPACK="Oracle_VM_VirtualBox_Extension_Pack-${VBOX_VERSION}.vbox-extpack"
  curl -fLO "${BASE_URL}/${EXTPACK}"
fi

curl -fLO "${BASE_URL}/SHA256SUMS"
sha256sum --ignore-missing -c SHA256SUMS

Install or replace the Extension Pack:

sudo VBoxManage extpack install --replace "$EXTPACK"

Read Oracle’s Personal Use and Evaluation License prompt, then type y if you accept the terms.

Verify that the pack is installed and usable:

sudo VBoxManage list extpacks
Extension Packs: 1
Pack no. 0:   Oracle VM VirtualBox Extension Pack
Version:      7.2.x
Usable:       true
Why unusable:

After verification, remove the downloaded installer and checksum file from the current directory:

rm -f "$EXTPACK" SHA256SUMS

Install Guest Additions in VirtualBox Guests

VirtualBox Guest Additions are installed inside each virtual machine, not on the Ubuntu host. They provide shared clipboard, drag-and-drop transfer, shared folders, dynamic resolution changes, and better guest display integration.

Install Guest Additions on Linux Guests

Inside the Linux guest VM, install build tools and matching guest kernel headers:

sudo apt update
sudo apt install build-essential dkms linux-headers-$(uname -r)

From the VirtualBox menu, select Devices, then Insert Guest Additions CD image. After the ISO mounts inside the guest, run the installer:

cd /media/$USER/VBox_GAs_*
sudo sh ./VBoxLinuxAdditions.run

If that path does not exist, run ls /media/$USER/ inside the guest and look for a mounted directory beginning with VBox_GAs.

Reboot the guest after installation:

sudo reboot

Install Guest Additions on Windows Guests

Inside a Windows guest VM, select Devices, then Insert Guest Additions CD image. If the installer does not start automatically, open the mounted CD drive in File Explorer and run VBoxWindowsAdditions.exe. Reboot Windows when the installer asks.

Verify Guest Additions on Linux Guests

After rebooting a Linux guest, confirm that the Guest Additions module loaded:

lsmod | grep vboxguest

If the module appears, test shared clipboard, display resizing, and shared folders from the VirtualBox VM settings that you enabled.

Update VirtualBox on Ubuntu

Both installation paths update through APT. For normal system maintenance, use the standard update and upgrade sequence:

sudo apt update
sudo apt upgrade

To upgrade only Oracle’s VirtualBox package, use:

sudo apt install --only-upgrade virtualbox-7.2

To upgrade only Ubuntu’s repository packages, use:

sudo apt install --only-upgrade virtualbox virtualbox-qt virtualbox-dkms

After a VirtualBox maintenance update, rerun the Extension Pack version-detection, checksum, and install commands if you use Oracle’s Extension Pack. A mismatched Extension Pack can become unusable even when the base VirtualBox package updated correctly. If you used Ubuntu’s virtualbox-ext-pack package, upgrade it with the rest of your Ubuntu packages.

Troubleshoot VirtualBox on Ubuntu

Fix Kernel Driver Not Installed (rc=-1908)

The error Kernel driver not installed (rc=-1908) usually means the VirtualBox host modules are missing, failed to build, or were blocked by Secure Boot. Check whether the matching kernel headers are installed:

dpkg-query -W "linux-headers-$(uname -r)"

If the command reports no package, install the headers and rebuild the modules with the command that matches your package source:

sudo apt install "linux-headers-$(uname -r)"

# Oracle package
sudo /sbin/vboxconfig

# Ubuntu multiverse package
sudo dpkg-reconfigure virtualbox-dkms

Then check the matching service again. Use vboxdrv for Oracle’s package or virtualbox for Ubuntu’s package:

# Oracle package
systemctl status vboxdrv

# Ubuntu multiverse package
systemctl status virtualbox

If the service still fails and Secure Boot is enabled, follow the MOK enrollment note in the configuration section, then reboot and rerun the status check.

Fix Unable to Locate Package virtualbox or dkms

virtualbox, virtualbox-qt, and virtualbox-dkms are in Ubuntu’s multiverse component, while dkms and build tools commonly come from main or universe. If APT cannot find one of those Ubuntu packages, enable Ubuntu’s repository components and refresh metadata:

sudo apt install software-properties-common
sudo add-apt-repository multiverse
sudo apt update

For a fuller component walkthrough, enable universe and multiverse on Ubuntu before retrying the install command.

Fix Oracle Repository Suite or Release File Errors

If apt update reports a missing Oracle Release file or suite mismatch, first confirm your Ubuntu codename and check the saved Oracle source. The suite should match your release: resolute for Ubuntu 26.04, noble for Ubuntu 24.04, or jammy for Ubuntu 22.04.

lsb_release -cs
grep -R "download.virtualbox.org/virtualbox/debian" /etc/apt/sources.list /etc/apt/sources.list.d/ 2>/dev/null

If the source is wrong or you no longer want Oracle’s repository, remove it and refresh APT. Then return to the repository setup section or install Ubuntu’s multiverse package instead:

sudo rm -f /etc/apt/sources.list.d/oracle-virtualbox.sources /usr/share/keyrings/oracle-virtualbox-2016.gpg
sudo apt update

Remove VirtualBox from Ubuntu

Remove the Extension Pack first if you installed it:

sudo VBoxManage extpack uninstall "Oracle VM VirtualBox Extension Pack"

If you installed Ubuntu’s virtualbox-ext-pack wrapper instead, remove it with:

sudo apt remove virtualbox-ext-pack

If you installed Oracle’s virtualbox-7.2 package, remove it with:

sudo apt remove virtualbox-7.2

If you installed Ubuntu’s repository packages, remove those packages instead:

sudo apt remove virtualbox virtualbox-qt virtualbox-dkms virtualbox-ext-pack

Use purge only when you also want to remove package-managed configuration files:

sudo apt purge virtualbox-7.2

For Ubuntu repository packages, use this purge command instead:

sudo apt purge virtualbox virtualbox-qt virtualbox-dkms virtualbox-ext-pack

If you added Oracle’s repository, remove its source file and keyring:

sudo rm -f /etc/apt/sources.list.d/oracle-virtualbox.sources /usr/share/keyrings/oracle-virtualbox-2016.gpg
sudo apt update

Optionally remove your account from the vboxusers group if you no longer need VirtualBox hardware access:

sudo gpasswd -d "$USER" vboxusers

Review autoremovable dependencies separately instead of combining cleanup with removal:

sudo apt autoremove --dry-run

Remove Virtual Machines and User Configuration

The next command permanently deletes local VM disk images and VirtualBox user settings. Skip it unless you have backups or no longer need those virtual machines.

rm -rf "$HOME/VirtualBox VMs" "$HOME/.config/VirtualBox"

Conclusion

VirtualBox is now installed from the correct Ubuntu source for your release, with kernel modules, user permissions, and optional Extension Pack support lined up. For related setup work, keep the guides to check your Ubuntu version and install the HWE kernel on Ubuntu nearby when troubleshooting release or kernel-module mismatches.

Share this guide

Help another Linux user troubleshoot faster

Share this guide with someone troubleshooting Linux systems or saving it for later.

Follow LinuxCapable

Want more LinuxCapable guides in Google?

Add LinuxCapable as a preferred source so Google can show our tutorials more often in Top Stories and mark them as preferred in AI Mode and AI Overviews when relevant.

Add LinuxCapable as a preferred source on Google
Search LinuxCapable

Need another guide?

Search LinuxCapable for package installs, commands, troubleshooting, and follow-up guides related to what you just read.

Found this guide useful?

Support LinuxCapable to keep tutorials free and up to date.

Buy me a coffeeBuy me a coffee

4 thoughts on “How to Install VirtualBox on Ubuntu 26.04, 24.04 and 22.04”

  1. amazing guide – the best I’ve seen
    I would love you to add a section on how to install the guest additions in the guest os
    I run into problems with installing guestadditions on the Arch VM

    Reply
Before commenting, please review our Comments Policy.
Formatting tips for your comment

You can use basic HTML to format your comment. Useful tags currently allowed in published comments:

You type Result
<code>command</code> command
<strong>bold</strong> bold
<em>italic</em> italic
<a href="https://example.com">link</a> link
<blockquote>quote</blockquote> quote block

Add to the discussion

Questions, fixes, command output, and version notes help keep this guide current.

Verify before posting: