thelinuxvault blog

Install VirtualBox on Ubuntu 18.04 Bionic Beaver Linux

VirtualBox, developed by Oracle, is a powerful, open-source Type 2 hypervisor that allows users to run multiple operating systems (guests) simultaneously on a single host machine. It is widely used for testing, development, and running legacy software across different OS environments.

Ubuntu 18.04 LTS (Bionic Beaver), released in April 2018, remains a popular choice for servers and desktops due to its stability and 5-year LTS support (extended until 2028 with ESM). This guide will walk you through two methods to install VirtualBox on Ubuntu 18.04: using Ubuntu’s default repositories (for stability) and Oracle’s official repositories (for the latest features). We’ll also cover post-installation setup, verification, troubleshooting, and uninstallation.

2026-02

Table of Contents#

Prerequisites#

Before installing VirtualBox, ensure your system meets these requirements:

1. System Requirements#

  • Ubuntu 18.04 LTS (64-bit; 32-bit is unsupported by modern VirtualBox versions).
  • At least 2 GB RAM (4 GB+ recommended for running guest OSes).
  • Virtualization Technology (VT-x/AMD-V) enabled in your system’s BIOS/UEFI (critical for performance).

2. Check Virtualization Support#

To confirm your CPU supports virtualization, run:

egrep -c '(vmx|svm)' /proc/cpuinfo
  • If the output is 0, virtualization is disabled in BIOS/UEFI (see Troubleshooting to fix this).
  • If the output is 1 or higher, virtualization is supported.

3. Update System Packages#

Always update your system before installing new software to avoid dependency conflicts:

sudo apt update && sudo apt upgrade -y

Method 1: Install VirtualBox from Ubuntu Repositories#

Ubuntu’s default repositories include a stable (but older) version of VirtualBox. This method is ideal for users prioritizing stability over the latest features.

Step 1: Install VirtualBox#

Run the following command to install VirtualBox and its dependencies:

sudo apt install virtualbox -y
  • The package name is virtualbox (not version-specific).
  • Ubuntu 18.04 repositories typically ship with VirtualBox 5.2.x (older but well-tested).

Step 2: Install VirtualBox Extension Pack (Optional)#

The Extension Pack adds features like USB 3.0 support, disk encryption, and remote display. To install it:

  1. Check your VirtualBox version:

    virtualbox --version

    Example output: 5.2.42_Ubuntur137960 (version 5.2.42).

  2. Download the matching Extension Pack from the VirtualBox Downloads Page (search for your version).

  3. Install the Extension Pack via GUI:

    • Launch VirtualBox → Go to File → Preferences → Extensions.
    • Click the "+" icon, select the downloaded .vbox-extpack file, and follow prompts to accept the license.

Method 2: Install VirtualBox from Oracle’s Official Repositories#

For the latest VirtualBox version (e.g., 7.x), use Oracle’s official repositories. This ensures access to new features, security patches, and bug fixes.

Step 1: Add Oracle’s GPG Key#

Oracle signs its packages with a GPG key to verify authenticity. Import it:

wget -q https://www.virtualbox.org/download/oracle_vbox_2016.asc -O- | sudo apt-key add -
  • If you get a wget: command not found error, install wget first:
    sudo apt install wget -y

Step 2: Add Oracle’s Repository#

Add the VirtualBox repository to your system. For Ubuntu 18.04 (Bionic), use:

echo "deb [arch=amd64] https://download.virtualbox.org/virtualbox/debian bionic contrib" | sudo tee /etc/apt/sources.list.d/virtualbox.list

Step 3: Update Package List#

Refresh your system’s package index to include Oracle’s repository:

sudo apt update

Step 4: Install VirtualBox#

Install the latest VirtualBox version (replace 6.1 with the current stable version if needed, e.g., 7.0):

sudo apt install virtualbox-6.1 -y
  • Verify the installed version:
    virtualbox --version

Step 5: Install the Latest Extension Pack#

For the latest Extension Pack, download it directly from Oracle:

wget https://download.virtualbox.org/virtualbox/6.1.46/Oracle_VM_VirtualBox_Extension_Pack-6.1.46.vbox-extpack

(Replace 6.1.46 with your installed VirtualBox version.)

Install it via the command line:

sudo VBoxManage extpack install Oracle_VM_VirtualBox_Extension_Pack-6.1.46.vbox-extpack

Type yes to accept the license agreement.

Post-Installation Setup#

To use VirtualBox effectively, add your user to the vboxusers group. This grants permissions for USB devices, shared folders, and other features.

Add User to vboxusers Group#

Run:

sudo usermod -aG vboxusers $USER
  • Replace $USER with your username if you’re running the command as root.
  • Log out and log back in for the change to take effect.

Verifying the Installation#

1. Check Version via Command Line#

virtualbox --version

Example output: 6.1.46r158378 (confirms successful installation).

2. Launch VirtualBox GUI#

  • From the command line:
    virtualbox
  • From the Ubuntu applications menu: Search for “VirtualBox” and click the icon.

If the VirtualBox window opens without errors, the installation is complete!

Uninstalling VirtualBox#

Uninstall from Ubuntu Repositories#

If you installed via Method 1:

sudo apt remove --purge virtualbox -y
sudo apt autoremove -y  # Remove leftover dependencies

Uninstall from Oracle Repositories#

If you installed via Method 2 (replace 6.1 with your version):

sudo apt remove --purge virtualbox-6.1 -y
sudo apt autoremove -y

To remove Oracle’s repository and GPG key (optional):

sudo rm /etc/apt/sources.list.d/virtualbox.list
sudo apt-key del 2980AECF  # Oracle's key fingerprint (verify with `sudo apt-key list`)

Troubleshooting Common Issues#

1. Kernel Module Errors (“vboxdrv not loaded”)#

If VirtualBox fails to start with a kernel module error, install dependencies for building kernel modules:

sudo apt install dkms linux-headers-generic -y

Then rebuild the VirtualBox kernel modules:

sudo /sbin/vboxconfig

2. Enable Virtualization in BIOS/UEFI#

If egrep showed 0 earlier, enable virtualization in BIOS/UEFI:

  1. Reboot your system and press the BIOS key (varies by manufacturer: F2, F10, Del, or Esc).
  2. Navigate to the Security or Advanced tab.
  3. Find options like “Intel VT-x”, “AMD-V”, or “SVM Mode” and set them to Enabled.
  4. Save changes and exit BIOS/UEFI.

3. Extension Pack Version Mismatch#

Always install the Extension Pack version matching your VirtualBox version. Mismatched versions cause errors like “Extension pack is not compatible”.

Conclusion#

You now have VirtualBox installed on Ubuntu 18.04! Use Method 1 for stability or Method 2 for the latest features. Remember to enable virtualization in BIOS/UEFI and add your user to the vboxusers group for full functionality.

VirtualBox is a versatile tool—explore creating virtual machines for testing Linux distros, running Windows apps, or setting up development environments!

References#