How to Install VirtualBox on Ubuntu

Published on

3 min read

Install VirtualBox on Ubuntu 22.04

VirtualBox is a powerful open-source virtualization software that allows you to create and run multiple virtual machines on your computer, regardless of the host operating system you use. This software provides a robust environment where you can experiment with various operating systems, applications, and configurations without affecting your primary system. VirtualBox is an excellent tool for creating flexible testing and development environments.

In this tutorial, we will walk you through the installation of VirtualBox on Ubuntu 22.04 using the Oracle repositories.

It is recommended to install VirtualBox using the Oracle repository, rather than from the default Ubuntu repository.

The Oracle repositories always have the most up-to-date release available for installation. The VirtualBox package available in the Ubuntu multiverse repository may not be the most recent version.

Installing VirtualBox from the Oracle Repositories

Installing VirtualBox is a straightforward process and can be completed within a matter of minutes. When this article, the latest version of VirtualBox is version 7.0.x.

To install VirtualBox from the Oracle repositories, follow these steps:

  1. Start by updating the apt packages list by issuing the following command:

    sudo apt update
  2. Import the Oracle public keys using the following command:

    wget -O- | \  sudo gpg --yes --output /usr/share/keyrings/oracle-virtualbox-2016.gpg --dearmor
  3. Add the VirtualBox APT repository to your system:

    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

    $(lsb_release -cs) prints the Ubuntu codename. For example, if you have Ubuntu version 22.04 the command will print jammy.

  4. Update the packages list so your system knows that you added a new repository:

    sudo apt update
  5. You can now install the latest version of VirtualBox, by running:

    sudo apt install virtualbox-7.0

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

That’s it! You have successfully installed VirtualBox on your Ubuntu machine. Your new tool is ready to use.

Installing VirtualBox Extension Pack

The VirtualBox Extension Pack provides several useful functionalities for guest machines, including virtual USB 2.0 and 3.0 devices, support for RDP, image encryption, and more.

It’s important to note that the version of the Extension Pack should match the version of the VirtualBox package already installed on your system. You can check the version of VirtualBox by typing:

VBoxManage -version

Download the extension pack file by typing:

Make sure you download the correct version.

When the download is completed, import the extension pack using the following command:

sudo VBoxManage extpack install Oracle_VM_VirtualBox_Extension_Pack-7.0.14.vbox-extpack

You will be presented with the Oracle license and prompted to accept their terms and conditions.


Do you agree to these license terms and conditions (y/n)?

Type y and hit Enter. Once the installation is completed, you will see the following output:

Successfully installed "Oracle VM VirtualBox Extension Pack".

Using VirtualBox

VirtualBox can be launched from the command line by typing virtualbox or by clicking on the VirtualBox icon.

When you start the application for the first time, a window like the following will appear:

Ubuntu Install Virtualbox

From here, you can create your first Windows or Linux guest machine by clicking in the “New” button.


We’ve shown you how to install VirtualBox on Ubuntu 22.04.

For more information about VirtualBox, visit the official VirtualBox documentation page.

If you want to manage your virtual machines through the command line, you can read our guide on how to How to install Vagrant on Ubuntu 20.04 .

Feel free to leave a comment if you have any questions.