How to install Virtualbox on Ubuntu 22.04

Endrit Qerreti

Endrit Qerreti

In this tutorial, you will learn how to install Virtualbox on Ubuntu 22.04.

Virtualbox is one of the most popular virtualization softwares that you can use to create and run virtual machines on your Ubuntu machine.

Installing Virtualbox on Ubuntu is simple, and it can be done easily by following the steps in this tutorial.

If you want to be able to use multiple operating systems under one operating system, then Virtualbox can make this happen.

You don't have to be an advanced Ubuntu user to make use of Virtualbox, as Virtualbox's UI is easy, and you can create your own virtual machine with no hassle via a few simple steps.

Install Virtualbox on Ubuntu

Step 1 - Add Virtualbox Key

First thing that you need to do before installing Virtualbox, is that you need to add Virtualbox key on your system.

To add Virtualbox key on your machine, simply run the command below.

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

The command above is using wget to download the Virtualbox key on the /usr/share/keyrings/ directory.

Step 2 - Add Virtualbox Repository

Next, proceed to import Virtualbox repository on your system. All you have to do is run the command below, and Virtualbox repository will be added on your machine.

echo 'deb [arch=amd64 signed-by=/usr/share/keyrings/oracle-virtualbox-2016.gpg] jammy contrib' | sudo tee -a /etc/apt/sources.list

Step 3 - Update your machine

Now that Virtualbox key and repository is fully set up, you need to update your system in order to be able to use the new Virtualbox repository that you added.

To update your machine, you can use GUI or terminal via the command below

sudo apt update

Step 4 - Install Virtualbox

Now you should be good to go, and run the following command, to install Virtualbox on your machine.

Virtualbox will be downloaded from the Virtualbox repository that you imported earlier.

sudo apt install virtualbox

Uninstall Virtualbox on Ubuntu

If you want to uninstall Virtualbox and remove it completely from your system, run the command below.

sudo apt remove virtualbox --purge


In this tutorial, you learned how to install and uninstall Virtualbox-7.0 on Ubuntu 22.04.

We used the official repository of Virtualbox to download and install virtualbox package on Ubuntu 22.04, via the terminal.