Let’s see how to Upgrade Vagrant. When you are using Vagrant with Virtualbox and you have updated your Virtualbox version to the latest 6.0 you will notice that Vagrant will stop working if you are running version 2.0.0 because it doesn’t support the latest version of VirtualBox and the same thing is likely to happen when Virtualbox will release version 7.0.
Vagrant | Check the version
Let’s have a look at our environment first:
OS: Ubuntu 18.04
VM: Virtual Box: 6.0
Tool: Vagrant 2.0.0
Lets first open the terminal to check our current installed and latest version available of Vagrant
the above command will output something like that
Installed Version: 2.0.0 Latest Version: 2.2.6 To upgrade to the latest version, visit the downloads page and download and install the latest version of Vagrant from the URL below: https://www.vagrantup.com/downloads.html If you're curious what changed in the latest release, view the CHANGELOG below: https://github.com/mitchellh/vagrant/blob/v2.2.6/CHANGELOG.md
Now that we know that there is a new version available we can follow the link above and download the package for our operative system.
In this case, it will be the Debian x64 bit.
We can install our package over the previous vagrant version, the installer will take care of that for us.
Upgrade Vagrant | Installation
We now have a file named vagrant_2.2.6_x86_64.deb in our download folder. To install it we can right-click on it and right at the top, we see open with software installer.
Now in my case, the software installer failed without any message so I have installed the package manually.
There are two options:
1. use apt
2. use dpkg
The first uses apt under the hood and in my case failed too with this error message:
sudo apt install vagrant_2.2.6_x86_64.deb E: dpkg was interrupted, you must manually run 'sudo dpkg --configure -a' to correct the problem.
Running the suggested command to correct the problem then try again won’t fix it but the second method works perfectly fine.
sudo apt install vagrant_2.2.6_x86_64.deb Reading package lists... Done Building dependency tree Reading state information... Done E: Unable to locate package vagrant_2.2.6_x86_64.deb E: Couldn't find any package by glob 'vagrant_2.2.6_x86_64.deb' E: Couldn't find any package by regex 'vagrant_2.2.6_x86_64.deb'
So simply run the following command will install the latest Vagrant version replacing the outdated version.
sudo dpkg -i vagrant_2.2.6_x86_64.deb (Reading database ... 476944 files and directories currently installed.) Preparing to unpack vagrant_2.2.6_x86_64.deb ... Unpacking vagrant (1:2.2.6) over (1:2.0.0) ... Setting up vagrant (1:2.2.6) ...
Voila’! We can now check that everything is up to date
vagrant version Installed Version: 2.2.6 Latest Version: 2.2.6 You're running an up-to-date version of Vagrant!
Wondering how to set up a development environment from scratch? In this article I got you covered. I hope it was helpful.