How to Install VirtualBox Ubuntu Linux 22.04/20.04

Oracle VM VirtualBox 7.0, the latest free and open-source hypervisor from Oracle has been released with numerous new features and improvements. The new version sees additions such as a recent utility showing performance statistics for running guests, secure boot support, Full VM encryption support (via CLI), and a reworked virtual machine wizard. Additionally, various bugs have been fixed in this release. For more information, visit the VirtualBox 7.0 changelog.

In the following tutorial, you will learn how to install VirtualBox 7.0 on your Ubuntu 22.10, 22.04 and 20.04 system by importing the official virtual box repository and installing the most up-to-date version using the command line terminal. The extra benefit for users using this method is that you will receive them instantly from the VirtualBox repository when updates drop.

Recommended Steps Before Installation

Before proceeding with the tutorial, ensuring your system is up-to-date with all existing packages is good.

sudo apt update

Optionally, you can list the updates for users who require review or are curious.

sudo apt --list upgradable

Proceed to upgrade any outdated packages using the following command.



sudo apt upgrade

Import VirtualBox Repository on Ubuntu Linux

Installing Required Packages

Before you begin, the following dependencies will need to be installed to install VirtualBox successfully. Most of these packages are already on your system, but running the command can help ensure they’re installed.

sudo apt install dirmngr ca-certificates software-properties-common apt-transport-https curl -y

If you skip and encounter issues, return and just run the command.

Import the GPG Key

The first step when installing VirtualBox latest build is first to add the GPG key to verify the authenticity of the packages.

curl -fSsL https://www.virtualbox.org/download/oracle_vbox_2016.asc | gpg --dearmor | sudo tee /usr/share/keyrings/virtualbox.gpg > /dev/null

Import VirtualBox Repository

The next step is to import the official repository from VirtualBox; ensure you import the correct one to match the Ubuntu version you are installing the software on, or you will not proceed much further when trying to run the installation command.

Import Jammy repository:

echo deb [arch=amd64 signed-by=/usr/share/keyrings/virtualbox.gpg] http://download.virtualbox.org/virtualbox/debian jammy contrib | sudo tee /etc/apt/sources.list.d/virtualbox.list

Import Focal repository:



echo deb [arch=amd64 signed-by=/usr/share/keyrings/virtualbox.gpg] http://download.virtualbox.org/virtualbox/debian focal contrib | sudo tee /etc/apt/sources.list.d/virtualbox.list

Now, update your repository list to reflect the new additions.

sudo apt update

Install VirtualBox 7.0 on Ubuntu Linux

With the setup complete, execute the installation command to install VirtualBox.

sudo apt install virtualbox-7.0 -y

Optionally, ensure that the VirtualBox installation was pulled directly from the source repository and check the current version installed using the apt-cache policy command.

apt-cache policy virtualbox-7.0

Example output:

apt cache policy version check on virtualbox 7.0 on ubuntu

Confirm if VirtualBox was installed successfully. Check the current status as follows.

systemctl status vboxdrv

Example output:



check virtualbox 7.0 status on ubuntu

If by chance this has not been activated, which by default it is when installing, use the following command that will start the service and enable it to be active from system boot.

sudo systemctl enable vboxdrv --now

Launch VirtualBox 7.0 on Ubuntu Linux

VirtualBox can be launched immediately from your terminal if opened with the following command.

virtualbox

However, many users on desktops would use the following desktop path.

Activities > Show Applications > Oracle VM Virtualbox

Example:

launch virtualbox 7.0 on ubuntu from application menu

Once open, you will arrive at the main screen, where you can begin to create virtual machines. It is very similar for users coming from VMWare, and users new to virtual machines should check out the VirtualBox user manual.



Example:

How to Install VirtualBox 7.0 on Ubuntu 22.04 LTS

Update VirtualBox 7.0 on Ubuntu Linux

Updating VirtualBox can be done using the command line terminal with the following standard commands you would have used at the start of the tutorial to check your system for updates.

sudo apt update && sudo apt upgrade

Most newer Linux users usually set up automatic updates or rely on the notifications from their desktop, especially from a Windows-type background. You should always check using the terminal at least once weekly to ensure you are not missing any updates. The terminal method will grab all available updates, ensuring your system is up-to-date.

Remove VirtualBox 7.0 on Ubuntu Linux

The removal of VirtualBox is straightforward. For users that want to remove the software entirely, use the following command.

sudo apt autoremove virtualbox-7.0 --purge

Note that this will delete all data, including all database data added with the –purge flag. Do not use the purge end flag if you wish to keep the data.

Next, remove the repository sources file using the following command.



sudo rm /etc/apt/sources.list.d/virtualbox.list

Optionally, you can remove the GPG key if you prefer.

sudo rm /usr/share/keyrings/virtualbox.gpg


Not what you were looking for? Try searching for additional tutorials.

Leave a Comment