VirtualBox is powerful open source virtualization software that allows you to create and run multiple virtual machines on your computer, regardless of which host operating system you use. This software provides a robust environment where you can experiment with various operating systems, applications and configurations without affecting the main system. VirtualBox is an excellent tool for creating flexible test and development environments.
In this tutorial we will walk you through installing VirtualBox on Ubuntu 22.04 using Oracle repositories.
It is recommended to install VirtualBox using the Oracle repository, rather than the default Ubuntu repository.
Oracle repositories always have the most up-to-date version available for installation. The VirtualBox package available in the Ubuntu Multiverse repository may not be the latest version.
Installing VirtualBox from Oracle repositories
Installing VirtualBox is a simple process and can be completed in minutes. As of this article, the latest version of VirtualBox is version 7.0.x.
To install VirtualBox from Oracle repositories, follow these steps:
Start by updating the apt package list by issuing the following command:
sudo apt update
Import Oracle public keys using the following command:
wget -O- https://www.virtualbox.org/download/oracle_vbox_2016.asc | \ sudo gpg --yes --output /usr/share/keyrings/oracle-virtualbox-2016.gpg --dearmor
Add the VirtualBox APT repository to your system:
echo "deb [arch=amd64 signed-by=/usr/share/keyrings/oracle-virtualbox-2016.gpg] http://download.virtualbox.org/virtualbox/debian $(lsb_release -cs) contrib" | \
sudo tee -a /etc/apt/sources.list.d/virtualbox.list
$(lsb_release -cs) prints the Ubuntu code name. For example, if you have Ubuntu version 22.04, the command will print
Update the package list so your system knows you've added a new repository:
sudo apt update
You can now install the latest version of VirtualBox, by running:
sudo apt install virtualbox-7.0
If you want to install another version, such as version 6.1, change
virtualbox-6.1 above command.
That's all! You have successfully installed VirtualBox on your Ubuntu computer. Your new tool is ready to use.
Installing the VirtualBox extension package
The VirtualBox Extension Pack provides several useful features for guest machines, including virtual USB 2.0 and 3.0 devices, support for RDP, image encryption, and more.
It is important to note that the Extension Pack version must match the version of the VirtualBox package already installed on your system. You can check your VirtualBox version by typing:
Download the extension package file by typing:
Make sure you download the correct version.
Once the download is complete, import the extension package 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 asked to accept its terms and conditions.
Do you agree to these license terms and conditions (y/n)?
y and press
Enter. Once the installation is complete, you will see the following output:
Successfully installed "Oracle VM VirtualBox Extension Pack".
VirtualBox can be started from the command line by typing
virtualbox or by clicking the VirtualBox icon.
From here you can create your first Windows or Linux guest computer by clicking the "New" button.
We showed 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 via command line, you can read our guide on how to install Vagrant on Ubuntu 20.04.
Feel free to leave a comment if you have any questions.