How To

Install VirtualBox on Ubuntu from Ubuntu Repositories

The simplest approach is Ubuntu’s multiverse repository. A single command installs both VirtualBox and the Extension Pack together:

bashsudo apt updatesudo apt install virtualbox virtualbox-ext-pack

You will be prompted to review and accept the Extension Pack license during the process. Once accepted, both packages install automatically with no additional steps.

This method is ideal for users who want a fast, no-fuss setup. The trade-off is that Ubuntu’s packaged version may trail the latest official VirtualBox release by a version or two. For everyday development and testing, this is rarely a concern.

Get the Latest Version via Oracle Repository

To always have the most current VirtualBox release — including the latest drivers, features, and security patches, install directly from Oracle’s official APT repository.

Step 1: Import Oracle’s GPG signing keys so your system trusts packages from this source:

bashwget -q https://www.virtualbox.org/download/oracle_vbox_2016.asc -O- | sudo apt-key add -wget -q https://www.virtualbox.org/download/oracle_vbox.asc -O- | sudo apt-key add -

Both commands should output OK.

Step 2: Add the Oracle VirtualBox repository to your package sources:

bashecho "deb [arch=amd64] https://download.virtualbox.org/virtualbox/debian $(lsb_release -cs) contrib" | \     sudo tee -a /etc/apt/sources.list.d/virtualbox.list

The $(lsb_release -cs) variable automatically inserts your Ubuntu codename, focal for Ubuntu 20.04, for example.

Step 3: Update the package index and install:

bashsudo apt updatesudo apt install virtualbox-6.1

Tip: Visit the VirtualBox downloads page before installing to confirm the current version number. Adjust the package name accordingly — for example, virtualbox-7.0 for a newer release.

Add the VirtualBox Extension Pack

The VirtualBox Extension Pack unlocks additional capabilities for guest machines, including:

  • Virtual USB 2.0 and USB 3.0 device passthrough
  • Remote Desktop Protocol (RDP) access to guest VMs
  • Disk image encryption to protect sensitive VM data
  • NVMe storage and PXE network boot support

Make sure the Extension Pack version exactly matches your installed VirtualBox version, then download it:

bashwget https://download.virtualbox.org/virtualbox/6.1.8/Oracle_VM_VirtualBox_Extension_Pack-6.1.8.vbox-extpack

Install it with the VBoxManage utility:

bashsudo VBoxManage extpack install Oracle_VM_VirtualBox_Extension_Pack-6.1.8.vbox-extpack

Accept the Oracle license by typing y when prompted. A progress bar confirms when the Extension Pack has installed successfully.

Launch VirtualBox

Once installed, start VirtualBox directly from the terminal:

bashvirtualbox

Or open the Activities panel, search for “VirtualBox”, and click the icon. On first launch, the VirtualBox Manager window appears, your central control panel for creating virtual machines, adjusting CPU and memory allocation, and managing snapshots. From here you can spin up your first Windows or Linux guest within minutes.

VirtualBox gives you a powerful, free virtualization layer on Ubuntu with minimal setup. The Ubuntu repository method gets you running immediately; the Oracle repository keeps you on the latest release with a few extra steps. Either way, once VirtualBox is live, you can start building guest machines right away. Want to manage VMs entirely from the command line? Pair VirtualBox with Vagrant for a fully scripted workflow. Questions? Leave a comment below.

Cyber Defence

Recent Posts

rmmod Command in Linux: Remove Kernel Modules and Blacklisting

The rmmod command in Linux removes a loaded module from the running kernel. Because the kernel has…

19 hours ago

free Command in Linux: Check Memory Usage and Interpret Output

The free command in Linux gives you a quick summary of RAM and swap usage. It reads…

19 hours ago

diff Command in Linux: Compare Files and Create Patches

The diff command in Linux compares two text files line by line and shows the lines that…

19 hours ago

Flush DNS Cache on Windows, Linux, and macOS: Quick Commands

DNS cache is a temporary database your OS and browser build as you browse. Each time you visit a website, the domain-to-IP mapping is saved locally, cutting out the round trip to a remote DNS server on repeat visits. Stale entries are the most common reason to flush the DNS cache: a server moves to a new IP, but your OS or browser still routes to the old address. This guide covers how to clear the DNS cache on Windows, Linux, and macOS, and how to flush the separate cache stored inside Chrome and Firefox. Flush DNS Cache on Windows The command is the same on Windows 10, Windows 11, and earlier supported releases. Open Command Prompt with administrator privileges. Type cmd in the Windows search bar, right-click Command Prompt, and select Run as…

19 hours ago

Change User Password in Ubuntu: Command Line and GNOME GUI

Using a strong, unique password for every account is one of the most effective security…

2 days ago

Enable and Disable the Root Account in Ubuntu: Full Guide

Ubuntu locks the root account by default. New users often wonder what the root password…

2 days ago