Ubuntu 22.04 how to install virtualbox plus vagrant

Ubuntu 22.04 how to install virtualbox plus vagrant

If you are currently using Ubuntu 22.04 and need to install vagrant along with virtualbox for some reason, this short guide may be useful to you. It will also save your time. Because I spent the whole day trying to figure out why it doesn't work :D

First of all, I want to note that at the time when I encountered this problem, the following versions were still relevant for Ubuntu 22.0:
VirtualBox 7.1.0 (virtualbox 6.1.5 in repository ubuntu)
Vagrant 2.4.1 (2.4.1 in repository ubuntu)

So virtualbox 6.1 stopped working after updating ubuntu 22.04 and vagrant 2.4.1 did not support the latest virtualbox

The provider 'virtualbox' that was requested to back the machine
'default' is reporting that it isn't usable on this system. The
reason is shown below:

Vagrant has detected that you have a version of VirtualBox installed
that is not supported by this version of Vagrant. Please install one of
the supported versions listed below to use Vagrant:
4.0, 4.1, 4.2, 4.3, 5.0, 5.1, 5.2, 6.0, 6.1, 7.0

A Vagrant update may also be available that adds support for the version
you specified. Please check www.vagrantup.com/downloads.html to download
the latest version.

So if you need to install virtualbox together with virtualbox on Ubuntu 22.04 then use:
VirtualBox 7.0  with Vagrant 2.4.1

Step-by-step actions

Step 1
sudo apt upgrade Update packages

Step 2
sudo apt install vagrant Install Vagrant from the repository

Step 3
Download the required version of VirtualBox(7.0) by the link  
Also, don't forget about the Extension Pack, if needed. It can be installed in the virtualbox GUI, Extension tab

Step 4
sudo apt install ~/Downloads/<name_of_package> Install the downloaded deb package

Step 5
vagrant up or vagrant init Run