Follow these steps to install VirtualBox using the terminal on Ubuntu Linux



The article guides through installing VirtualBox on Ubuntu Linux via the command line, offering a more efficient, controlled installation. Steps include updating Ubuntu, adding Oracle repositories, and installing VirtualBox 7.0. It then details installing the VirtualBox Extension Pack, which expands VirtualBox’s features, ensuring the version matches the main software.

This article explains how to install VirtualBox using the command line terminal on Ubuntu Linux.

VirtualBox is a free and open-source hypervisor software that allows users to create and run virtual machines on their computers. It enables users to install and run multiple operating systems on a single machine without needing separate physical hardware.

There are multiple ways to install VirtualBox. The easiest way for most might be to download the executable in their browser and install it. However, the command line terminal also provides an efficient installation.

Using the command line terminal to install VirtualBox on Ubuntu Linux has advantages. First, it allows for a more efficient and streamlined installation process. Additionally, it provides more granular control over the installation process and allows for customization of the installation settings.

Finally, it can be useful for users who prefer to use the command line interface for their work and want to avoid using graphical user interfaces.

Installing VirtualBox from the Oracle Repositories

Using the terminal to install VirtualBox will require Oracle repositories. Use the steps below to add Oracle repositories to Ubuntu.

First, update Ubuntu with the command below.

sudo apt update

Then, import Oracle’s public key using the command below.

wget -O- | \
  sudo gpg --yes --output /usr/share/keyrings/oracle-virtualbox-2016.gpg --dearmor

Once the key is imported, run the command below to add the VirtualBox APT repository to your machine.

echo "deb [arch=amd64 signed-by=/usr/share/keyrings/oracle-virtualbox-2016.gpg] $(lsb_release -cs) contrib" | \
  sudo tee -a /etc/apt/sources.list.d/virtualbox.list

After adding the repository, you can then install VirtualBox.

First, update the repository list.

sudo apt update

Then, install VirtualBox version 7.0

sudo apt install virtualbox-7.0

If you want to install another version, for example, version 6.1, use virtualbox-6.1 in the command above instead.

The steps above should install VirtualBox.

Install VirtualBox Extension Pack

Now that the VirtualBox software has been installed, you may need to install its extension pack to enhance your experience with VirtualBox.

Installing the VirtualBox Extension Pack is useful because it adds additional features and functionality to the VirtualBox software. These features include support for USB 2.0 and 3.0 devices, VirtualBox Remote Desktop Protocol (VRDP), and the ability to encrypt virtual disk images.

The extension pack to install must match the version of VirtualBox installed.

Run the command to get the VirtualBox version.

VBoxManage -version

The command should output the version installed.


Now, run the command below to get the extension pack that matches the version installed.


Finally, install the download file using the command below.

sudo VBoxManage extpack install Oracle_VM_VirtualBox_Extension_Pack-7.0.14.vbox-extpack

At this point, VirtualBox and its extension pack should be installed and ready to use.

install VirtualBox using the terminal on Ubuntu Linux

That should do it!


This post showed you how to install VirtualBox using the command terminal on Ubuntu Linux. Please use the comments form below if you find errors or have something to add.

Like this:

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.