Website Vidya
Linux & ServersStep-by-Step Guide

How to Install VirtualBox on Ubuntu 24.04 LTS: Step-by-Step

Learn how to install virtualbox on ubuntu 24.04 LTS with Oracle repositories, Extension Pack, guest additions, Secure Boot signing, and user groups.

RR
Rajesh RayLead Systems Educator
Published:
5 min read
PDF Cheat Sheet
How to Install VirtualBox on Ubuntu 24.04 LTS: Step-by-Step
AI Executive SummaryWebsiteVidya AI

5 min read

Learn how to install virtualbox on ubuntu 24.04 LTS with Oracle repositories, Extension Pack, guest additions, Secure Boot signing, and user groups.

Key Highlights
  • Prerequisites and Supported Releases
  • Step 1: Verifying Hardware Virtualization Support
  • Step 2: Installing Kernel Headers and DKMS Dependencies
Grounded in full engineering runbookWebsiteVidya AI Engine

Oracle VM VirtualBox is a powerful, open-source x86 and AMD64/Intel64 desktop virtualization hypervisor (Type-2) used by software developers, system administrators, and security researchers worldwide.

VirtualBox enables you to execute multiple isolated guest operating systems—including various Linux distributions, Windows 10/11, and BSD variants—simultaneously on a single physical host without repartitioning hard drives.

While Ubuntu includes open-source VirtualBox packages in its universe repository, installing the latest release directly from Oracle's official repository ensures you receive the latest VirtualBox 7.0 improvements, such as full virtual TPM 2.0 emulation, Secure Boot support, and Direct3D 11 acceleration.

In this guide, we walk through how to install virtualbox on ubuntu 24.04 LTS step-by-step, install the Extension Pack, configure UEFI Secure Boot kernel signing, and add user permissions.

Advertisement

Prerequisites and Supported Releases

This guide is thoroughly verified on Ubuntu 24.04 LTS (Noble Numbat) & Ubuntu 22.04 LTS. The instructions apply cleanly to cloud instances (AWS EC2, Google Compute Engine, DigitalOcean, Hetzner), bare-metal servers, and local virtual machines.

Before proceeding, ensure you have the following requirements satisfied:

  • A computer or workstation running Ubuntu 24.04 LTS or Ubuntu 22.04 LTS with a graphical desktop.
  • A 64-bit CPU supporting hardware virtualization (Intel VT-x or AMD-V) enabled in your BIOS/UEFI.
  • A non-root user account with sudo administrative privileges.
  • At least 8 GB of RAM and 30 GB of free storage for hosting virtual machines.

Step 1: Verifying Hardware Virtualization Support

Before installing any hypervisor, ensure your computer's CPU supports hardware virtualization and that the feature is enabled in your motherboard's BIOS or UEFI settings.

Advertisement

Query your CPU flags using grep or install the cpu-checker utility:

If the output returns a count greater than 0, your CPU hardware supports virtualization:

# Check CPU hardware virtualization flags:
egrep -c '(vmx|svm)' /proc/cpuinfo
# Output > 0 confirms support (vmx = Intel, svm = AMD)

# Alternative check using cpu-checker:
sudo apt update && sudo apt install -y cpu-checker
kvm-ok
# Expected output confirms: INFO: /dev/kvm exists
# KVM acceleration can be used

Step 2: Installing Kernel Headers and DKMS Dependencies

VirtualBox compiles custom host kernel modules (such as vboxdrv, vboxnetflt, and vboxnetadp) to interact directly with host CPU and memory hardware.

Install Dynamic Kernel Module Support (dkms), GNU compiler tools, and the exact kernel header packages matching your active kernel:

Advertisement

DKMS ensures that whenever your Ubuntu system updates its Linux kernel, VirtualBox kernel modules are automatically rebuilt:

# Install essential build tools, dkms, and kernel headers:
sudo apt update
sudo apt install -y build-essential dkms linux-headers-$(uname -r)

Step 3: Adding the Official Oracle VirtualBox APT Repository

To install the latest official VirtualBox 7.0 release, configure Oracle's official APT repository using modern signed-by keyrings.

First, download and dearmor Oracle's public GPG signing key into /etc/apt/keyrings/:

Next, add the official repository source configuration file pointing to your Ubuntu release codename (noble for 24.04):

# Create keyrings directory:
sudo install -m 0755 -d /etc/apt/keyrings

# Download and dearmor Oracle public GPG key:
curl -fsSL https://www.virtualbox.org/download/oracle_vbox_2016.gpg | \
  sudo gpg --dearmor --yes -o /etc/apt/keyrings/virtualbox.gpg
sudo chmod a+r /etc/apt/keyrings/virtualbox.gpg

# Add the Oracle VirtualBox repository to APT sources:
echo \
  "deb [arch=amd64 signed-by=/etc/apt/keyrings/virtualbox.gpg] https://download.virtualbox.org/virtualbox/debian \
  $(. /etc/os-release && echo "$VERSION_CODENAME") contrib" | \
  sudo tee /etc/apt/sources.list.d/virtualbox.list > /dev/null

# Refresh package cache:
sudo apt update

Step 4: Installing VirtualBox 7.0 on Ubuntu 24.04

With the official repository added and package index refreshed, install VirtualBox 7.0 via APT:

APT automatically downloads the application binaries, Qt GUI interface, and compiles the host kernel modules:

If your system uses UEFI Secure Boot, APT will prompt you to create a MOK (Machine Owner Key) password to sign the kernel modules.

# Install VirtualBox 7.0:
sudo apt install -y virtualbox-7.0

# Check kernel module status:
sudo systemctl status vboxdrv
# Output confirms: Active: active (exited) or running

Step 5: Installing the VirtualBox Extension Pack

The VirtualBox Extension Pack delivers vital proprietary functionality, including virtual USB 2.0/3.0 controller support, VirtualBox RDP remote desktop, disk encryption (AES), and Intel PXE boot ROMs.

Download the Extension Pack matching your exact installed VirtualBox version directly from Oracle:

Install the Extension Pack using the VBoxManage command-line utility:

# Detect installed VirtualBox version:
VBOX_VER=$(vboxmanage -v | cut -dr -f1)

# Download matching Extension Pack:
cd /tmp
wget "https://download.virtualbox.org/virtualbox/${VBOX_VER}/Oracle_VM_VirtualBox_Extension_Pack-${VBOX_VER}.vbox-extpack"

# Install the Extension Pack (accept license automatically with echo 'y'):
echo 'y' | sudo vboxmanage extpack install --replace "Oracle_VM_VirtualBox_Extension_Pack-${VBOX_VER}.vbox-extpack"

# Verify installed extension packs:
vboxmanage list extpacks
# Output confirms: Extension Packs: 1 ... Usable: true

Step 6: Adding Your User Account to the vboxusers Group

To allow virtual machines to attach USB devices directly from your physical host, your active user account must belong to the vboxusers system group.

Add your user account to the group using usermod:

Apply the group change immediately using newgrp or log out and log back in:

# Add current user to the vboxusers group:
sudo usermod -aG vboxusers $USER

# Apply group membership immediately without logging out:
newgrp vboxusers

# Launch VirtualBox from terminal or desktop:
virtualbox &

Troubleshooting and Common Errors

When configuring Ubuntu servers, unexpected permission errors, network timeouts, or lock contention can occur. Review these common issues and verified resolutions:

Kernel driver not installed (rc=-1908) / The VirtualBox Linux kernel driver is not loaded

Cause: The vboxdrv kernel module failed to compile or Secure Boot blocked unsigned third-party kernel modules.

Resolution: Recompile kernel modules using sudo /sbin/vboxconfig and enroll MOK key upon reboot if prompted.

sudo /sbin/vboxconfig

VT-x/AMD-V hardware acceleration is not available on your system

Cause: Hardware virtualization is disabled in your computer's BIOS/UEFI settings.

Resolution: Reboot your computer, enter BIOS/UEFI settings, and enable Intel Virtualization Technology (VT-x) or AMD SVM.

egrep -c '(vmx|svm)' /proc/cpuinfo

USB devices are greyed out or inaccessible inside guest OS

Cause: The active host user is not a member of the vboxusers group, or the Extension Pack is missing.

Resolution: Install the Extension Pack and run sudo usermod -aG vboxusers $USER followed by a reboot.

sudo usermod -aG vboxusers $USER

Security Best Practices and Hardening

The VirtualBox Extension Pack is licensed under the Personal Use and Evaluation License (PUEL); enterprise commercial deployments require an Oracle license.

Isolate untrusted guest virtual machines on a Host-Only or Internal Network adapter to prevent malicious guest code from scanning your local LAN.

Keep VirtualBox updated via APT to patch virtualization escape vulnerabilities.

Deepen your Linux system administration skills with our related production-tested guides:

Authoritative References and Official Documentation

Frequently Asked Questions

Quick answers to common questions and configurations

4 FAQs
KVM (Kernel-based Virtual Machine) is a Type-1 bare-metal hypervisor built directly into the Linux kernel, offering superior performance for server workloads. VirtualBox is a Type-2 desktop hypervisor with a rich graphical user interface, making it easier for desktop users to run interactive operating systems.
Inside the guest virtual machine menu, click Devices > Insert Guest Additions CD Image, open a terminal inside the guest, and run sudo /media/$USER/VBox_GAs_*/VBoxLinuxAdditions.run.
Yes. You can manage headless virtual machines using the VBoxManage CLI command or remote web management tools like phpVirtualBox.
Run VBoxManage startvm "VM_NAME" --type headless to launch the virtual machine silently in the background.
RR
Written byVerified Author

Rajesh Ray

I’m Rajesh Rai, a full-stack developer, Linux administrator, and technology enthusiast passionate about making complex technology easier to understand and use.

SPAM-FREE MODERATED DISCOURSE

Join the Conversation & Perspective

Have thoughts, counterpoints, or reflections on this story? Engage directly with fellow readers and editorial contributors.

AT
MP
JV
+2

No comments on this guide yet. Be the first to share your thoughts or ask a question!

Recommended Reading10 Guides

Related Technical Guides

Tested runbooks, server administration walkthroughs, and troubleshooting guides

Featured Infrastructure PartnerUp to 75% OFF + 3 Months Free

Supercharge Your Linux & Cloud Workloads with Hostinger

Deploy high-speed NVMe KVM VPS, Docker containers, and LiteSpeed-accelerated WordPress servers in under 60 seconds with full root access, dedicated IPv4, and 24/7 technical support.

Pure NVMe SSD StorageFull Root Access & SSHFree Domain & Unlimited SSL99.9% Uptime SLA
Plans from$2.99/mo
Claim Hostinger DealAffiliate link • Special discount applied at checkout