Mattiman's avatar

Updating Vagrant and Homestead

I'm currently running VirtualBox 5.0.20 and Box laravel/homestead 0.5.0 on my mac. I think it's running globally, not on a per project bases.

The latest versions are: VirtualBox 5.1.10 Vagrant 1.9.1 Homestead 4.0 box version 1.0.1?

Updating these has always been a gigantic hassle. Always spend hours or days finding answers for problems I encounter. So before updating everything now, I'd like to ask:

1/ What exactly does "Homestead 4.0" and "box version 1.0.1" mean? I thought "Homestead" is a vagrant box itself?

2/ What are the exact update steps for all these? (virtual box, vagrant, homestead) In the official docs there is not a single line of documentation on updating. Elsewhere I find completely different instructions:

http://www.darwinbiler.com/keeping-your-homestead-box-up-to-date/
cd ~/Homestead
vagrant box update
vagrant destroy
vagrant up
# purge old version
vagrant box remove laravel/homestead --box-version=0.4.0

https://laracasts.com/discuss/channels/general-discussion/updating-homestead?page=1
Use "homestead update"

https://www.joeferguson.me/laravel-homestead-4-0-and-box-1-0/
cd /path/to/homestead
git fetch origin
git checkout v4.0.0
vagrant destroy
rm -rf .vagrant
vagrant up

And there are even more explanations I found differing from these.

And this is only about the homestead part. All explanations leave out the Vitualbox and Vagrant updates. Those are software packages (.dmg for mac). Can I assume updating is done by running those installers? Will they overwrite the previous versions?

If anybody can help me out here that'd be appreciated!

0 likes
19 replies
ejdelmonico's avatar
Level 53

Ok, here you go:

  1. Destroy your box and remove old version
  2. Update VirtualBox to 5.1.10 with the extensions if needed
  3. Update Vagrant to 1.9.1
  4. Rename you Homestead directory to Homestead-0ld
  5. Run vagrant box add laravel/homestead
  6. cd ~ and then git clone https://github.com/laravel/homestead.git Homestead. Your old Homestead.yaml config file in the .homestead directory will be used by the new install. If you don't want the old file, then rm the .homestead directory before cloning and then run bash init.sh.
  7. Run vagrant up and that should be it.

After completing that, you should be able to access whatever project links you have in your Homestead.yaml. Some newer commands are vagrant up to start the box and vagrant halt to stop it. vagrant reload to reload the box. Also, if you want to use mariaDB, then place mariadb: true before authorize in your Homestead.yaml.

5 likes
Mattiman's avatar

Hi @ejdelmonico thanks for your answer. If I may ask some follow up questions:

  • How do you do step 1 "destroy your box and remove old version"?
  • Why is your set of steps different from that from Joe Ferguson for example?

I really appreciate all the help, but it's utterly confusing to read different instructions in different places and every few months when I have to update homestead. Each time I make notes what I did last time, but then half a year later it doesn't work anymore and when asking online I get different instructions. Especially not understanding every line of instruction, why it is there and what it is doing.

For example, why are there two steps (5 and 6) both adding homestead? First the vagrant box add larval/homestead and after that a git clone homestead.

Thanks again for the help.

ejdelmonico's avatar

well, the easiest way is to do vagrant box destroy laravel/homestead or just delete the vm from Virtualbox. Well step 5 downloads a fresh vagrant box for laravel/homestead and step 6 is cloning the home software repository. They are two different things.

yes, I agree the different instructions can drive you mad but you must understand that everyone has a different platform so instructions vary. I just listed what I do for myself. The concrete instruction are found in the docs for VirtualBox, Vagrant and Homestead. I don't know who Joe Ferguson is so I can't answer that question.

Mattiman's avatar

Hi @ejdelmonico, if you say "the easiest way is to do vagrant box destroy laravel/homestead or just delete the vm from Virtualbox", do you mean running the command in the terminal? $ vagrant box destroy laravel/homestead

The steps 5 and 6 are still a bit unclear. What is "the home software repository"? And what the "vagrant box for homestead"?

The problem is that there are -zero, nada- instructions in the official documentation on updating Homestead. It literally only described a fresh installation. I really don't understand this oversight.

ejdelmonico's avatar

All vagrant commands are in the terminal. Deleting in VirtualBox is done in the GUI for VirtualBox.

No, there isn'y any guidance for updating. Basically, I have been doing the same routine for several years now and I just passed along what I have done. I am running MacOS 10.12.1 with VirtualBox 5.1.10, vagrant 1.9.1 and Homestead 4.0.0.

Can you show what you get from running this in the terminal? vagrant box list

Mattiman's avatar

I get

$ vagrant box list
laravel/homestead (virtualbox, 0.4.4)
laravel/homestead (virtualbox, 0.5.0)
ejdelmonico's avatar

Ok, first delete the "Homestead-7" box from Virtualbox. Choose the option to not keep any files.

Those are old boxes you can open terminal and run these commands separately

vagrant box remove laravel/homestead --provider=virtualbox --box-version=0.4.0

vagrant box remove laravel/homestead --provider=virtualbox --box-version=0.5.0

These commands will remove the old outdated boxes. After you are done, Make sure you are running the latest VirtualBox and vagrant. Then, post back

Mattiman's avatar

Ok I have done that. I can open VirtualBox and see it's the latest version, but I don't know how to check which version vagrant is installed now.

Mattiman's avatar

Ok that's returning 1.9.1 :)

So far so good

ejdelmonico's avatar

Ok, Homestead-7 VM is gone from VirtualBox correct? If not , delete it. Then, rename your Homestead directory to Homestead-old.

Mattiman's avatar

Which one would it be, the last one of these?

.homestead
.vagrant.d
/code/Homestead/
/Homestead

I'm not sure what the others are, or if they are old and can be removed.

ejdelmonico's avatar

Yes the Last one. It should be in your Home directory and the folder is Homestead. Just highlight the folder and hit and use the right arrow to go to the end and add "-old"...then click away.

Let me know when you have completed that and we will add the vagrant box and clone a new copy of Homestead to your home directory using Terminal.

Mattiman's avatar

Ok back from sleep, changed the name of the folder :)

Mattiman's avatar

Hi @svpernova09 that is great of course. Except for me currently. I'm halfway the process @ejdelmonico describes. In his process I now have to do:

$ vagrant box add laravel/homestead

Which I did. And after that:

$ cd ~ 
$ git clone https://github.com/laravel/homestead.git Homestead

The official docs now say:

git pull origin master

What's the difference between the two? Does it matter?

Mattiman's avatar

Ok I followed the instructions from @ejdelmonico and have everything updated successfully! I did

$ vagrant box add laravel/homestead
$  git clone https://github.com/laravel/homestead.git Homestead
$ cd ~/Homestead
$ vagrant up

After this I had to recreate the project databases and run artisan migrate and seed again.

Not sure which process to follow in the future, the official one or that from ejdelmonico I used now, so if you have any comments on the differences, please share.

svpernova09's avatar

Follow the official doc next time. @ejdelmonico had you wipe everything and start over from scratch. Not always a bad idea, just more effort.

1 like
Mattiman's avatar

Ok thanks both @ejdelmonico and @svpernova09 It's kind of clear now. One procedure wipes out everything and installs fresh, the other updates from within vagrant. If the last one works, that's more convenient of course. If not, wiping out and installing fresh is probably the solution.

Please or to participate in this conversation.