I use Linux Mint 19.2 as daily driver on my ThinkPad L480. This step by step tutorial will guide you through the process of getting the latest versions of VirtualBox and Vagrant instead of the outdated versions available in the official Ubuntu repositories.
VirtualBox and Vagrant receive updates on Linux much often than the repositories update. If you want to consistently get these updates when they become available, you’ll want to add VirtualBox and Vagrant repository to your system. This will allow you to get notified for new versions and update trough Linux Mint Update Manager and apt.
Step 1: Add VirtualBox Repository Key
In order to install packages from the VirtualBox repository, you must first add the repository key, used by apt to validate its authenticity.
To add the repository key, run the commands below:
wget -q https://www.virtualbox.org/download/oracle_vbox_2016.asc -O- | sudo apt-key add - wget -q https://www.virtualbox.org/download/oracle_vbox.asc -O- | sudo apt-key add -</div>
Step 2: Add VirtualBox Repository
Now that the repository key is added to Ubuntu system, run the commands below to add the repository itself.
sudo sh -c 'echo "deb [arch=amd64] https://download.virtualbox.org/virtualbox/debian bionic contrib" >> /etc/apt/sources.list.d/virtualbox.list' sudo apt update
Step 3: Installing VirtualBox
At this point, Linux Mint should be ready to install the latest version of VirtualBox. If you have previously installed older versions of it, you need to remove it first:
sudo apt remove virtualbox virtualbox-5.1
Install the required dependencies and VirtualBox itself using the following commands:
sudo apt-get -y install gcc make linux-headers-$(uname -r) dkms sudo apt-get install virtualbox-5.2
You should have now the latest version of VirtualBox installed.
Step 4: Install the latest Vagrant from an unofficial repository
Unfortunately, Vagrant has no official Debian/Ubuntu repository. Luckily, I found a working solution provided on https://vagrant-deb.linestarve.com. This enables you to install the latest version of Vagrant using apt or Linux Mint Update Manager.
Disclaimer: This is an unofficial Debian repository for Vagrant, hosted by Wolfgang Faust. Add the repository to your system at your own risk using the following commands:
sudo bash -c 'echo deb https://vagrant-deb.linestarve.com/ any main > /etc/apt/sources.list.d/wolfgang42-vagrant.list' sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-key AD319E0F7CFFA38B4D9F6E55CE3F3DE92099F7A4 sudo apt-get update sudo apt-get install vagrant