Installing VirtualBox and Vagrant on Ubuntu 20.04

One of my current interests outside of the DevOps life is MediaWiki. I want to learn about it and use it to create an online archive with a group of friends.

I am planning to deploy it on a tiny EC2 instance on AWS. However, for my learning process I prefer to use something I don’t need to pay for. I will use Vagrant and VirtualBox to run Amazon Linux on my local machine, and then translate that onto an EC2 instance.

There is one more plus to this, Vagrant can be used to launch and provision EC2 instances. I haven’t decided if I’m going to use this feature, but it’s good to have the option.

This article explains how to install VirtualBox and Vagrant on Ubuntu 20.04.


  1. Add a new file to /etc/apt/sources.list.d, in my case I named it virtualbox.list. Its contents need to be:
deb [arch=amd64] focal contrib
  1. Download & register Oracle’s public key
curl |  sudo apt-key add -
  1. Time to install VirtualBox
sudo apt-get update
sudo apt-get install virtualbox-6.1

If you are using UEFI Secure Boot you will need to take some more steps. The install process will ask you to choose a password and confirm it on reboot. See the screen shot below.

VBox install UEFI
  1. Reboot. If you try to start VirtualBox before rebooting you’ll probably get a message similar to this one:
WARNING: The vboxdrv kernel module is not loaded. Either there is no module
         available for the current kernel (5.4.0-42-generic) or it failed to
         load. Please recompile the kernel module and install it by

           sudo /sbin/vboxconfig

         You will not be able to start VMs until this problem is fixed.

You should be able to start VirtualBox now.


Vagrant is available as part of the Ubuntu repositories. However, those are usually out of date, my advice is to download the latest version from Vagrant’s download page.

At the time when I wrote this wee guide, the latest version is 2.2.10 and I downloaded it from the Debian section.

After downloading the .deb file you just need to install it with dpkg.

sudo dpkg -i vagrant_2.2.10_x86_64.deb

You can now check if vagrant is installed by running:

vagrant --version
Vagrant 2.2.10

Leave a Reply

Your email address will not be published.