How to Install VirtualBox on Ubuntu 24.04

Anyone can easily run multiple operating systems on one host simultaneously, provided they have VirtualBox installed. Even for Ubuntu 24.04, you can install VirtualBox and utilize it to run any supported operating system.The best part about VirtualBox is that it is open-source virtualization software, and you can install and use it anytime. Whether you are stuck on how to install VirtualBox on Ubuntu 24.04 or looking to advance with other operating systems on top of your host, this post gives you two easy methods.

Two Methods of Installing VirtualBox on Ubuntu 24.04

There are different ways of installing VirtualBox on Ubuntu 24.04. For instance, you can retrieve a stable VirtualBox version from Ubuntu’s repository or add Oracle’s VirtualBox repository to install a specific version. Which method to use will depend on your requirements, and we’ve discussed the methods in the sections below.

Sponsored

Method 1: Install VirtualBox via APT
The easiest way of installing VirtualBox on Ubuntu 24.04 is by sourcing it from the official Ubuntu repository using APT.
Below are the steps you should follow.
Step 1: Update the Repository
In every installation, the first step involves refreshing the source list to update the package index by executing the following command.

$ sudo apt update

Step 2: Install VirtualBox
Once you’ve updated your package index, the next task is to run the install command below to fetch and install the VirtualBox package.

See also  New Active Directory Integration features in Ubuntu 22.04 (part 4) – Scripts execution
$ sudo apt install virtualbox

Step 3: Verify the Installation
After the installation, use the following command to check the installed version. The output also confirms that you successfully installed VirtualBox on Ubuntu 24.04.

$ VboxManage version

Method 2: Install VirtualBox from Oracle’s Repository
The previous method shows that we installed VirtualBox version 7.0.14. However, if you visit the VirtualBox website, depending on when you read this post, it’s likely that the version we’ve installed may not be the latest.

Although the older VirtualBox versions are okay, installing the latest version is always the better option as it contains all patches and fixes. However, to install the latest version, you must add Oracle’s repository to your Ubuntu before you can execute the install command.

Step 1: Install Prerequisites
All the dependencies you require before you can add the Oracle VirtualBox repository can be installed when you install the software-properties-common package.

$ sudo apt install softwarepropertiescommon

Step 2: Add GPG Keys
GPG keys help verify the authenticity of repositories before we can add them to the system. The Oracle repository is a third-party repository, and by installing the GPG keys, it will be checked for integrity and authenticity.
Here’s how you add the GPG keys.

See also  How to Install Apache Maven on Ubuntu 22.04
Sponsored
$ wget q https://www.virtualbox.org/download/oracle_vbox_2016.asc -O- | sudo apt-key add –

You will receive an output on your terminal showing that the key has been downloaded and installed.
Step 3: Add Oracle’s VirtualBox Repository
Oracle has a VirtualBox repository for all supported Operating Systems. To fetch this repository and add it to your /etc/apt/sources.list.d/, execute the following command.

$ echo “deb [arch=amd64] https://download.virtualbox.org/virtualbox/debian $(lsb_release -cs) contrib” | sudo tee /etc/apt/sources.list.d/virtualbox.list

The output shows that a new repository entry has been created from which we will source VirtualBox when we execute the install command.

Step 4: Install VirtualBox
With the repository added, let’s first refresh the package index by updating it.

$ sudo apt update

Next, specify which VirtualBox you want to install using the below syntax.

$ sudo apt install virtualbox[version]

For instance, if the latest version when reading this post is version 7.1, you would replace version in the above command with 7.1.

However, ensure that the specified version is available on the VirtualBox website. Otherwise, you will get an error as you can’t install something that can’t be found.

Conclusion

VirtualBox is an effective way of running numerous Operating Systems on one host simultaneously. This post shares two methods of installing VirtualBox on Ubuntu 24.04. First, you can install it via APT by sourcing it from the Ubuntu repository. Alternatively, you can add the Oracle repository and specify a specific version number for the VirtualBox you want to install.

Leave a Comment

Only people in my network can comment.