Installing multiple Laravel homestead environments

- 1 answer

Ad

I was wondering how I would be able to run multiple versions of homestead without having VirtualBox crash.

I am currently running a default installation of the laravel homestead, but I need to install another older version, the reason is that in current version 0.4.0 the mysql server is 5.7 which is fine, but i need another environment with 5.6 because i have an old project which requires 5.6, so homestead version 0.3.0 would be fine.

Just to be clear: I know how to run multiple sites. That is not the issue. I just want to run a second, custom version of the Laravel Homestead Vagrant box, while still having the possibility to run my normal one.

Details: i managed to add both versions. Output of:

vagrant box list
laravel/homestead (virtualbox, 0.3.0)
laravel/homestead (virtualbox, 0.4.0)

so version 0.4.0 is running fine, now how i can run 0.3.0 ?

Thanks in advance!

Ad

Answer

Ad

Ok i managed it. I will post the solution for those who faced this issue, because I was not able to find a step by step guide with a homestead related instructions.

Without too much theory the steps are:

  1. Decide which box version you need from here (https://atlas.hashicorp.com/laravel/boxes/homestead), in my case it was 0.3.0 and run

    vagrant box add laravel/homestead --box-version 0.3.0

  2. Find on github the propper release of homestead (https://github.com/laravel/homestead/releases) in my case it was (v2.1.8) and download and extract it to a directory for example Homestead2 in your home folder
  3. Inside Homestead2 directory find scripts/homestead.rb file and edit it. find lines

    config.vm.box = settings["box"] ||= "laravel/homestead"
    

    config.vm.hostname = settings["hostname"] ||= "homestead"

between them add line, in my case :

config.vm.box_version = "0.3.0"

you can also rename

vb.name = settings["name"] ||= "homestead"

if you wish

  1. from within this directory run vagrant up

after this you can use it as usual.

I hope this helps somebody.

Ad
source: stackoverflow.com
Ad