Install VirtualBox on Ubuntu 22.04

Download VirtualBox’s Repo GPG Key

wget -O- | sudo gpg --dearmor --yes --output /usr/share/keyrings/oracle-virtualbox-2016.gpg

Add VirtualBox Repo to Ubuntu 22.04

echo "deb [arch=amd64 signed-by=/usr/share/keyrings/oracle-virtualbox-2016.gpg] $(lsb_release -cs) contrib" | sudo tee /etc/apt/sources.list.d/virtualbox.list

Run System Update

sudo apt update

Check the output of the following command, and look for … download.virtualbox …
If everything is correct, you should find a line in the output containing a string like the one I have made in bold.

Install VirtualBox
sudo apt install virtualbox-7.0
Install VirtualBox Extension Pack. To verify the exact version of the installed locally VirtualBox, you can use vboxmanage, a build-in VirtualBox’s command:
vboxmanage -v | cut -dr -f1

You must then download the Extension Pack with the same version.


Install the extension

sudo vboxmanage extpack install Oracle_VM_VirtualBox_Extension_Pack-7.0.6.vbox-extpack

verify the installed VirtualBox’s extension pack version by running the following:

vboxmanage list extpacks

Add User to vboxusers Group

sudo usermod -a -G vboxusers $USER

Now perform a reboot. After login, check that you are in the vboxusers group with this command:

groups $USER