42

How do I upgrade Vagrant to latest version in Ubuntu?

$ sudo apt-get update
$ sudo apt-get install vagrant
$ vagrant -v
Vagrant 1.4

Latest version is 1.6.5

7 Answers 7

28

The official Download Vagrant webpage has all the available downloads for the latest version of Vagrant (2.0.1). Please download the proper package for your operating system (Linux deb) and architecture (32-bit or 64-bit OS). You can find SHA256 checksums for packages here.

Download the .deb file and double-click it to open it for installation in the Ubuntu software application. The new installation will properly overwrite and remove old files. It is recommended that no other Vagrant processes are running during the upgrade process.

The names of the vagrant .deb files are as follows:

  • 32-bit architecture: vagrant_2.0.1_i686.deb
  • 64-bit architecture: vagrant_2.0.1_x86_64.deb

...where 2.0.1 in the above is the version number of the latest version of Vagrant from the official download Vagrant webpage, which changes whenever the latest version of Vagrant is updated. The latest version of Vagrant from the official download Vagrant website current to the last time this answer was edited is Vagrant 2.2.6.

If you download the text file that has the SHA256 checksums for Vagrant packages, you will find the same two package names and their SHA256 checksums.

2
  • SO you dont have to deinstall the old version? Just run the installer of latest version?
    – Adam
    Jan 19, 2020 at 17:00
  • Download the new Vagrant package and install it over the existing package. The installers will properly overwrite and remove old files. It is recommended that no other Vagrant processes are running during the upgrade process.
    – karel
    Jan 19, 2020 at 17:16
25

If you don’t want to have to update manually, Hashicorp now has an official repository you can install from to get automatic updates. To use it, just run:

curl -fsSL https://apt.releases.hashicorp.com/gpg | sudo apt-key add -
sudo apt-add-repository "deb [arch=amd64] https://apt.releases.hashicorp.com $(lsb_release -cs) main"
sudo apt-get update

Edit: this post originally described a third-party deb repository. Now that Hashicorp has an official one of their own I've updated it to describe that one.

NOTE: if you previously set up that third-party repository, there is an extra step you need to take to ensure you will get updates from the new repository. Please see the old repo instructions for details.

3
  • The MIT keyserver didn't work yesterday at all, whereas I've never had the Ubuntu key server fail on me. Sure seems more reliable to put that one and avoid problems for people.
    – MacroMan
    Aug 13, 2019 at 9:25
  • @MacroMan Good to know that it's been having problems again. I agree and have edited the post to put the Ubuntu one there as well.
    – Wolfgang
    Aug 14, 2019 at 17:56
  • 1
    alternative: launchpad.net/~tiagohillebrandt/+archive/ubuntu/vagrant
    – rubo77
    Apr 27, 2020 at 14:11
6

For servers, the following will first authenticate and then install Vagrant version 2.0.2 (currently the latest) on Ubuntu x64:

curl -O https://releases.hashicorp.com/vagrant/2.0.2/vagrant_2.0.2_x86_64.deb
curl -O https://releases.hashicorp.com/vagrant/2.0.2/vagrant_2.0.2_SHA256SUMS
curl -O https://releases.hashicorp.com/vagrant/2.0.2/vagrant_2.0.2_SHA256SUMS.sig
curl -sS https://keybase.io/hashicorp/key.asc | gpg --import
gpg --verify vagrant_2.0.2_SHA256SUMS.sig vagrant_2.0.2_SHA256SUMS
shasum -a 256 -c <(cat vagrant_2.0.2_SHA256SUMS | grep 64.deb) -s
sudo apt install ./vagrant_2.0.2_x86_64.deb
1
  • I tried this on WSL (updated W10) but it didn't install, nor gave any error messages.
    – 1.61803
    Jun 3, 2018 at 0:05
5

Simple as a possible Debian install:

curl https://releases.hashicorp.com/vagrant/2.2.7/vagrant_2.2.7_x86_64.deb -O
sudo dpkg -i vagrant_2.2.7_x86_64.deb
rm vagrant_2.2.7_x86_64.deb
vagrant -v
1
sudo add-apt-repository ppa:tiagohillebrandt/vagrant
sudo apt update

This will add a repository for your actual ubuntu version. If you are on 20.10 (groovy) replace groovy with focal and call sudo apt update again.

Then install vagrant again:

sudo apt install vagrant

And update all plugins:

vagrant plugin update
0

Some operating system distributions include a vagrant package in their upstream package repos. Please do not install Vagrant in this manner. Typically these packages are missing dependencies or include very outdated versions of Vagrant. If you install via your system's package manager, it is very likely that you will experience issues. Please use the official installers on the downloads page.

Source https://learn.hashicorp.com/tutorials/vagrant/getting-started-install

For upgrading vagrant to the lastest version, just download the package in accordance with your operating system distribution from their download page https://www.vagrantup.com/downloads

For ubuntu you can download the debian package and run

sudo dpkg -i your-downloaded-file.deb
0

I had Vagrant 2.2.6 installed and I could not upgrade it further using apt-get. The latest version was 2.4.0.

I used Homebrew to install it on my Ubuntu 22.04 machine:

# sudo apt-get uninstall -y vagrant
brew tap hashicorp/tap
brew install hashicorp/tap/vagrant

And now,

vagrant --version
# Vagrant 2.4.0

This installation mean is listed on the vagrant official documentation.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .