2

What advantages does updating/upgrading my vagrant virtual machine with vagrant box update have (if any) over doing a regular sudo apt-get update && sudo apt-get upgrade from within the VM? My guest OS is Ubuntu.

1 Answer 1

4

When you do vagrant box update all it does is update the local box a Vagrant machine was initially built with. Meaning any already existing Vagrant machines will not be upgraded.

But if you do an update via apt-get within the Ubuntu Vagrant machine, then your already existing machine will be upgraded.

The pluses and minuses depend on usage.

For example, let’s say you do tons of development on one of those boxes and have tons of work on that Vagrant machine that is not easily replicated. In a case like that, upgrading Ubuntu via apt-get is the safest bet since it will assure you that any work you have done on that box after it was built will still be there when the upgrade completes.

The main benefit of vagrant box update is for creating new Vagrant machines. Using the example above, if you know you can replicate your work on that box, then blowing away that Vagrant machine is fine. Cases where you would do something like this would be where you have provisioning scripts in place to configure the Vagrant machine on creation and even if you deploy code to the box from some other place—like a GitHub repository—so your Vagrant machine is just a platform of some type.

In my case, I routinely build, destroy and rebuild Vagrant machines since I build them mainly for deployment and provisioning testing before moving onto a more permanent environment. It let’s me test ideas on server configuration before I make them “live” on a “real” virtual machine or bare metal server.

0

You must log in to answer this question.

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