How to Install VirtualBox on Ubuntu
Updated on
•6 min read

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:
Start by updating the apt packages list by issuing the following command:
sudo apt update
Import the 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 codename. For example, if you have Ubuntu version 22.04 the command will printjammy
.Update the packages list so your system knows that you 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, for example version 6.1, change
virtualbox
withvirtualbox-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
7.0.14r161095
Download the extension pack file by typing:
wget https://download.virtualbox.org/virtualbox/7.0.14/Oracle_VM_VirtualBox_Extension_Pack-7.0.14.vbox-extpack
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:
0%...10%...20%...30%...40%...50%...60%...70%...80%...90%...100%
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:

From here, you can create your first Windows or Linux guest machine by clicking in the “New” button.
Conclusion
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.