How to Install VirtualBox on Ubuntu 26.04, 24.04 and 22.04

Last updated Tuesday, April 28, 2026 3:39 pm Joshua James 7 min read 4 comments

To install VirtualBox on Ubuntu 24.04, use Oracle’s official APT repository because it provides the current VirtualBox 7.2 branch with normal APT updates. Ubuntu 26.04 needs a different path for now: Oracle has not published a resolute repository yet, so use Ubuntu’s multiverse virtualbox package until Oracle adds native 26.04 packages.

This guide covers Ubuntu 26.04, 24.04, and 22.04 on amd64 hosts. You will pick the correct package source for your release, install VirtualBox with matching kernel headers, add your account to the vboxusers group, and optionally install the matching Extension Pack and Guest Additions.

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.

Install VirtualBox on Ubuntu

Start by confirming your Ubuntu release. The codename decides whether you should use Ubuntu’s own package or Oracle’s APT repository:

lsb_release -ds
lsb_release -cs

Use the table below before running any repository commands. The current split is important because Oracle’s Linux downloads page lists Ubuntu 24.04 and 22.04 packages for VirtualBox 7.2, but not Ubuntu 26.04.

Ubuntu ReleaseRecommended MethodCurrent Package PathBest Fit
Ubuntu 26.04 LTSUbuntu multiverse repositoryvirtualbox 7.2.xUse this until Oracle publishes a resolute repository.
Ubuntu 24.04 LTSOracle official APT repositoryvirtualbox-7.2 7.2.xBest choice for the latest official Oracle build on Noble.
Ubuntu 22.04 LTSOracle official APT repositoryvirtualbox-7.2 7.2.xBest choice when you need the current branch instead of Ubuntu’s older 6.1 package.

Oracle’s Ubuntu packages are amd64 host packages. Do not point Ubuntu 26.04 at the older noble or jammy Oracle repository as a workaround; use Ubuntu’s package for 26.04 until Oracle publishes a supported resolute branch.

Install VirtualBox on Ubuntu 26.04

Ubuntu 26.04 currently installs VirtualBox from the Ubuntu multiverse repository. This package is slightly behind Oracle’s latest 7.2 build, but it avoids the unsupported Oracle repository error for resolute.

Update package metadata first:

sudo apt update

If your account cannot run sudo, add a new user to sudoers on Ubuntu first, then return to this installation.

Install VirtualBox, its graphical interface, and matching kernel headers:

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

Verify that APT selected Ubuntu’s multiverse package:

apt-cache policy virtualbox

Relevant output on Ubuntu 26.04 includes the resolute/multiverse source. The exact package version changes as Ubuntu publishes maintenance updates:

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

Install VirtualBox 7.2 on Ubuntu 24.04 or 22.04

For Ubuntu 24.04 and 22.04, Oracle’s APT repository is the cleanest official VirtualBox download path. If you are trying to download VirtualBox for Ubuntu 24.04, this repository method is safer than a one-off .deb download because APT keeps the package updated. It uses the same packages 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 small tools needed for Oracle’s signed repository:

sudo apt update
sudo apt install curl ca-certificates gpg lsb-release

The gpg package converts Oracle’s signing key to a binary keyring, while lsb-release supplies the release codename used in the repository file.

Import Oracle’s VirtualBox Signing Key

Import the Oracle VirtualBox signing key into /usr/share/keyrings so APT can verify repository packages:

curl -fsSL https://www.virtualbox.org/download/oracle_vbox_2016.asc | sudo gpg --dearmor --yes -o /usr/share/keyrings/oracle-virtualbox-2016.gpg

Add the Oracle VirtualBox Repository

To add the VirtualBox repository on Ubuntu 24.04 or 22.04, create the Oracle repository file only on supported Ubuntu codenames. The check below allows noble and jammy, then stops with a clear message on resolute or any unsupported release:

UBUNTU_CODENAME=$(lsb_release -cs)

case "$UBUNTU_CODENAME" in
  noble|jammy) ;;
  *)
    echo "Oracle's VirtualBox repository does not publish packages for $UBUNTU_CODENAME yet."
    echo "Use the Ubuntu repository method for Ubuntu 26.04."
    exit 1
    ;;
esac

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

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

sudo apt update

Install VirtualBox 7.2 from Oracle

Install VirtualBox 7.2 plus the build tools and kernel headers needed for its host kernel modules:

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

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 on Ubuntu 24.04 shows the noble/contrib source. Ubuntu 22.04 shows the same package branch with jammy/contrib instead. The exact maintenance build changes as Oracle updates VirtualBox:

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

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

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 Ubuntu 26.04 using Ubuntu’s repository package, check virtualbox.service:

systemctl status virtualbox

A working Ubuntu package service reports active (exited):

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

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

systemctl status vboxdrv

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

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

If Secure Boot is enabled and VirtualBox reports unsigned-module or verification errors, enroll the DKMS Machine Owner Key with sudo mokutil --import /var/lib/shim-signed/mok/MOK.der, set a one-time password, reboot, choose Enroll MOK, and 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 Ubuntu’s repository package on Ubuntu 26.04:

sudo systemctl enable virtualbox --now

Use this command for Oracle’s virtualbox-7.2 package on Ubuntu 24.04 or 22.04:

sudo systemctl enable vboxdrv --now

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. 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.

Detect the installed VirtualBox version first. This command works with both Oracle packages, which usually report a value such as 7.2.8r173730, and Ubuntu packages, which may include an Ubuntu suffix:

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

Download the matching Extension Pack from Oracle:

curl -fLO "https://download.virtualbox.org/virtualbox/${VBOX_VERSION}/Oracle_VirtualBox_Extension_Pack-${VBOX_VERSION}.vbox-extpack"

Install or replace the Extension Pack:

sudo VBoxManage extpack install --replace "Oracle_VirtualBox_Extension_Pack-${VBOX_VERSION}.vbox-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:

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

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 on Ubuntu 24.04 or 22.04, use:

sudo apt install --only-upgrade virtualbox-7.2

To upgrade only Ubuntu’s repository packages on Ubuntu 26.04, use:

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

After a VirtualBox maintenance update, rerun the Extension Pack version-detection, download, and install commands if you use the Extension Pack. A mismatched Extension Pack can become unusable even when the base VirtualBox package updated correctly.

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:

sudo apt install linux-headers-$(uname -r)
sudo /sbin/vboxconfig

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

# Ubuntu repository package on Ubuntu 26.04
systemctl status virtualbox

# Oracle package on Ubuntu 24.04 or 22.04
systemctl status vboxdrv

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 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 Release File Errors on Ubuntu 26.04

If apt update reports that https://download.virtualbox.org/virtualbox/debian resolute Release does not have a Release file, the Oracle repository was added on Ubuntu 26.04. Remove that unsupported source and use Ubuntu’s package instead:

sudo rm -f /etc/apt/sources.list.d/oracle-virtualbox.sources /usr/share/keyrings/oracle-virtualbox-2016.gpg
sudo apt update
sudo apt install virtualbox virtualbox-qt linux-headers-$(uname -r)

Recheck Oracle’s Linux downloads page later if you specifically need the Oracle build on Ubuntu 26.04. Once a native resolute branch exists, the repository method can be expanded safely.

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 Oracle’s virtualbox-7.2 package on Ubuntu 24.04 or 22.04, remove it with:

sudo apt remove virtualbox-7.2

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

sudo apt remove virtualbox virtualbox-qt virtualbox-dkms

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

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.

Follow LinuxCapable

Want more LinuxCapable guides in Google?

Add LinuxCapable as a preferred source so Google can show more of our fresh Linux tutorials in Top Stories and From your sources 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
<blockquote>quote</blockquote> quote block

Got a Question or Feedback?

We read and reply to every comment - let us know how we can help or improve this guide.

Let us know you are human: