How to destroy and recreate vagrant/homestead machine?

Yevgeniy Afanasyev picture Yevgeniy Afanasyev · Feb 24, 2019 · Viewed 7.4k times · Source

I'm running Laravel on Vagrant Box (homestead)

When I'm doing vagrant up, I'm getting a message:

: A newer version of the box 'laravel/homestead' is available and already
: installed, but your Vagrant machine is running against
: version '6.3.0'. To update to version '7.1.0',
: destroy and recreate your machine.

What commands should I run and what are potential problems I should be prepared for?

Answer

1000Nettles picture 1000Nettles · Feb 24, 2019

As ceejayoz mentioned, you do not have to do this, you can just continue running the same version. Homestead is meant to be able to be torn down / built back up quickly, with all configuration living within the Homestead.yaml and Vagrantfile files. It's supposed to be able to do the heavy lifting for you with those config files.

As you mentioned, you have your database in Homestead. If you have some data there that is not local test data, ensure you get that exported before destroying. Some people manually modify their Homestead VM via SSH which is not recommended (as you should be using the Homestead.yaml file for changes), but if you have, keep a list of the changes you made and where you made them.

Here is a rundown of things you may want to keep before destroying:

  • Your Homestead.yaml file, just in case
  • Your Vagrantfile file(s) (if you've made custom changes)
  • Database data
  • Files used / generated by your application (logs, for instance.)
  • aliases file, if you've made custom changes to it
  • Elasticsearch data (if you use it)
  • Neo4j data (if you use it)

As for commands to run, the documentation says it better than I ever could: https://laravel.com/docs/5.7/homestead#updating-homestead