Last Updated on 1 week by Sachin G

When I first started experimenting with virtualization, one of the biggest challenges I faced was figuring out the right way to set up VirtualBox on Ubuntu. Whether you’re running Ubuntu 22.04, 24.04, or the upcoming 25.04 release, the process is almost identical. VirtualBox is a widely used, open-source virtualization platform that allows users to run multiple operating systems on a single host machine. This blog post walks through the VirtualBox installation on Ubuntu 22.04, 24.04, and 25.04, helping users unlock full Ubuntu virtualization setup functionality while covering necessary dependencies, features, and optional enhancements.

Why Use VirtualBox on Ubuntu?

  • It supports Windows, macOS, Linux, and more, providing flexibility for users with different operating systems.
  • Test new OS versions using ISO files
  • It is freely available for personal and professional use, and its source code is also accessible.
  • You can use snapshots of virtual machines at different states, allowing easy rollback to a previous state.
  • Run Windows or other distros on a VirtualBox Ubuntu host
  • Resources like CPU and memory can be dynamically allocated.
  • We can also configure various network modes, including NAT, network bridging, and Host-Only, to suit different networking requirements.
  • We can also choose between dynamically allocated and fixed-size virtual hard disks, providing flexibility in storage management.
  • Set up cloud development or software testing environments.
  • It can run without showing a desktop interface, which is useful for servers.
  • If you have more than one monitor, VirtualBox can use them all at the same time.
  • it makes it easy to share files between your computer and the virtual one.
  • Getting VirtualBox is easy, and it comes with a simple interface to manage your virtual machines.
  • It has a lot of helpful information and a community where people share advice and solutions.

Step 1: Enable Virtualization in BIOS/UEFI

Before proceeding, ensure BIOS/UEFI virtualization is enabled. This is a hardware requirement for running VirtualBox efficiently.

  • For Intel CPUs: Enable VT-x
  • For AMD CPUs: Enable AMD-V

Restart the machine and access BIOS settings to enable this option.

Step 2: Update Your Ubuntu System

Before installing VirtualBox, always make sure your system is up to date. Outdated packages can cause conflicts. Run the following commands in your terminal:

 sudo apt update | sudo apt upgrade -y 

Step 3: Install Required Dependencies for VirtualBox

VirtualBox requires certain kernel modules and dependencies to run properly. To install them, execute:

sudo apt install -y gcc make perl dkms build-essential

These packages ensure that VirtualBox can compile kernel modules during installation. Missing them often leads to the dreaded “kernel driver not installed” error.

Pro Tip: Even if you’ve installed VirtualBox before, re-checking dependencies saves time when troubleshooting.

Step 4: Install the Latest VirtualBox from the Oracle Repository

Download & register the Oracle-provided public key for verifying to authenticate. The command below is doing both downloading and registering.

sudo wget -O- https://www.virtualbox.org/download/oracle_vbox_2016.asc | sudo gpg --yes --output /usr/share/keyrings/oracle-virtualbox-2016.gpg --dearmor 

The command below will add the Oracle repository. This command adds Oracle’s VirtualBox repository to your system’s list of repositories.

echo "deb [arch=amd64] http://download.virtualbox.org/virtualbox/debian $(lsb_release -sc) contrib" | sudo tee /etc/apt/sources.list.d/virtualbox.list 

Step 5: Install & Launch VirtualBox

Here’s where things get exciting—we’ll now install VirtualBox itself. Ubuntu provides VirtualBox in its official repositories, but it’s often outdated. The best approach is to install the latest version from Oracle’s repository before installation.

Install and update before installation using the following command

sudo apt-get update
sudo apt-get install virtualbox-7.0 

Step 6: Add User to vboxusers Group

Ensure smooth access to USB devices and other features by adding your user to the “vboxusers” group:

sudo usermod -aG vboxusers $USER 

With the installation complete, you can now launch from the application menu or use the Terminal:

virtualbox

Learn Smarter. Level Up Faster →

Want to master Linux, DevOps, Ansible, or Cloud workflows the smart way? I’ve curated a list of top-rated, real-world Udemy courses — based on student reviews and practical feedback.

Visit the Recommended Courses page to explore and enroll in courses trusted by the community.

See Curated Courses →

Step 7: Installing the VirtualBox Extension Pack

The Extension Pack adds extra features like:

  • USB 2.0/3.0 device support
  • VirtualBox RDP (Remote Desktop Protocol)
  • Disk encryption
  • NVMe and PXE boot support

To install it:

  1. Download the matching Extension Pack from the Oracle VirtualBox downloads page.
  2. Install it with the following command (replace 7.0.18 with your version)
sudo VBoxManage extpack install Oracle_VM_VirtualBox_Extension_Pack-7.0.18.vbox-extpack

Verify installation:

vboxmanage --version
Ubuntu terminal showing VirtualBox installed successfully
Screenshot by TechTransit.org: VirtualBox installation complete on Ubuntu

Warning: The extension pack is not open-source—it’s free for personal use, but commercial users need a license.

Step 8: Create Your First Virtual Machine on Ubuntu

Open the VirtualBox GUI interface

  • Click “New” to create a VM on VirtualBox
  • Choose OS type (e.g., Ubuntu, Windows)
  • Allocate RAM and CPU
  • Create a virtual hard disk
  • Select the downloaded ISO to install in VirtualBox

Common Issues and Fixes (Troubleshooting Guide)

  • Kernel Driver Not Installed: Run
sudo /sbin/vboxconfig
  • USB Device Not Recognized: Ensure you’ve installed the Extension Pack.
  • Slow Performance: Increase RAM and CPU allocation or enable virtualization in BIOS (VT-x/AMD-V).
  • Networking Issues: Switch VM to “Bridged Adapter” mode to allow internet access.

Optional Setting: Configure VM Settings & Features

Enhance your virtual machine configuration with the following:

  • Enable snapshots for instant backups
  • Use network bridging for better connectivity
  • Customize shared folders to exchange files between the host and the guest
  • Tune DKMS (Dynamic Kernel Module Support) for driver compatibility

These adjustments help manage Linux virtual machines efficiently on your VirtualBox Ubuntu host.

Install VirtualBox on Ubuntu –  About information
Screenshot by TechTransit.org: VirtualBox Interface on Ubuntu

Installing VirtualBox on Ubuntu (whether it’s 22.04, 24.04, or 25.04) is easier than it looks once you know the steps. You’ve updated your system, installed dependencies, set up VirtualBox, added the extension pack, and even created your first VM. From here, the possibilities are endless—whether you want to practice DevOps, test new OS releases, or simply sandbox risky applications.

Remember: virtualization is like having a safety net. You can experiment freely without worrying about breaking your main system.

So go ahead, fire up your new virtual machine, and start exploring!

FAQs

Q1: Can I run Windows 11 inside VirtualBox on Ubuntu?

Yes, you can run Windows 11 inside VirtualBox, but make sure you allocate at least 4GB RAM and enable EFI settings for compatibility.

Q2: Is VirtualBox better than VMware for Ubuntu?

For personal use and open-source enthusiasts, VirtualBox is often preferred due to its free licensing. VMware Workstation, however, has more enterprise-level features.

Q3: How much RAM should I allocate to a VM?

It depends on your system. A good rule of thumb: allocate half of your available RAM but keep at least 2GB for the host.

Q4: Do I need to enable virtualization in BIOS?

Yes, most modern processors require VT-x (Intel) or AMD-V enabled in BIOS to run VirtualBox properly.

Q5: Is the VirtualBox Extension Pack mandatory?

No, but it’s highly recommended if you need USB, RDP, or disk encryption support.