6

I currently have Vagrant 1.8.1 installed in my Ubuntu 16.04

I'm thinking to upgrade it to Vagrant 2.0.0

The problem is I'm not sure if my vagrant files and VMs gets removed if I directly install Vagrant 2.0.0 using apt-get install vagrant.

Is it safe to update using apt-get or is there any way to do that.

Sukumar
  • 173
  • 2
  • 3
  • 10

3 Answers3

21

Vagrant repository probably not updated to the latest version, this is the reason that it always install older version when apt-get install vagrant command is used.

The easiest way to pull and install latest version using terminal is to find the path to the .deb file and install it using dpkg

You may get the list of all the vagrant updates here,

https://releases.hashicorp.com/vagrant/

I got this as latest version from above archive,

https://releases.hashicorp.com/vagrant/2.0.4/vagrant_2.0.4_x86_64.deb

Once you have that link, delete previous version of vagrant (if it is installed) as follows,

sudo apt-get remove --auto-remove vagrant
rm -r ~/.vagrant.d

and install newest version,

wget https://releases.hashicorp.com/vagrant/2.0.4/vagrant_2.0.4_x86_64.deb
sudo dpkg -i vagrant_2.0.4_x86_64.deb

Once done, you can verify if its successfully installed,

vagrant version
Sufiyan Ghori
  • 18,164
  • 14
  • 82
  • 110
0

The safest way to upgrade any program, is to use sudo apt-get upgrade <program name>. Your files won't be affected

Note that sudo apt-get install <program name> will not affect any of your files either.

Hollyol
  • 827
  • 1
  • 13
  • 25
  • Tried doing **apt-get upgrade vagrant** **apt-get --only-upgrade vagrant** **apt-get --only-upgrade vagrant=2.0.0** **apt-get --only-upgrade install vagrant=2.0.0** **apt-get install vagrant** But nothing worked fine. The installed version is still 1.8.1 where as the latest version is 2.0.0 from website. – Sukumar Oct 29 '17 at 10:25
  • 1
    I tried to install it myself using `apt-get install vagrand` and also got the version 1.8.1, i think the version 2.0 is not yet available on ubunut's repositories, you sould install it from vagrant's website instead. This - (https://superuser.com/questions/845987/how-do-i-upgrade-vagrant-to-last-version-in-ubuntu/845989) should help – Hollyol Oct 29 '17 at 10:43
  • Yes. thinking to do the same. But will it affect any of my existing VMs or Vagrant files? – Sukumar Oct 29 '17 at 10:51
  • Some newer syntax may not be supported any more in vagrant 2.0. More information here : https://www.vagrantup.com/docs/installation/upgrading.html - But your files won't be removed, for more security, you can copy them in an other directory (located outside vagrant's range) – Hollyol Oct 29 '17 at 11:02
0

You can just download the new version from vagrant official site

install it and then try running vagrant -v in terminal, if is showing old version or not detecting vagrant run sudo dpkg -i vagrant_2.2.9_x86_64.deb (check your version of vagrant, I have put mine), now run vagrant -v again, you should see the new version.

Prafulla Kumar Sahu
  • 9,321
  • 11
  • 68
  • 105