A simple and easy-to-follow guide to install Oracle VirtualBox in Ubuntu, Linux Mint.
Oracle’s VirtualBox is a virtualization application which brings several advanced features. It can dynamically allocate virtual machine storage, USB, networking, NVMe support and so on. However, other free and open-source virtual machine apps are available such as virt-manager, GNOME Boxes, etc. They have their own benefits and features. However, VirtualBox is a little advanced, hence ideal for experienced users.
Here’s how you can install it in Ubuntu and Linux Mint (latest versions). And these steps also should work in Debian and other Debian & ubuntu-based distros.
Install Oracle VirtualBox in Ubuntu, Linux Mint
VirtualBox 7.0+ requires several Qt5 dependencies and associated packages to build kernel modules. First, open a terminal and install the following packages. These are necessary to build the kernel modules.
sudo apt install gcc make perl
Download the DEB package for your system’s Ubuntu version from the link below.
Once downloaded, go to the downloaded folder (usually ~/Downloads) and run the following. Make sure you change the file name as per the file you downloaded.
sudo dpkg -i virtualbox-7.0_7.0.2-154219~Ubuntu~jammy_amd64.deb
The above command is likely to cause a dependency error. If it does, run the following. Don’t try to install the dependent packages separately by yourself; let the
apt take care of it.
sudo apt --fix-broken install
The above command will install the following dependencies for Virtualbox.
And finally, it will resume the installation.
Uninstall, re-install and upgrade
If you want to uninstall and reinstall, then you can run the following command to uninstall. Make sure to change the version accordingly in the below command.
sudo apt remove virtualbox-7.0
In addition, if you want to upgrade to the latest version, you must uninstall it first. Then re-install using the above methods with a fresh download. All your created VM and its data are kept during the upgrade. So, you can get all of your VMs created in the prior version. Ideally, they are kept at
~./VirtualBox VMs in your home directory.
In this guide, you learnt how to install Oracle VirtualBox in Ubuntu and Linux Mint easily. The steps are tested in Ubuntu and Linux Mint. However should work in Debian, elementary OS and other related distros. I hope it helps. If you run into any errors, let me know in the comment box below.