Reputation: 41400
I need to update laravel/homestead? It is a Vagrant box. I'm using it for my dev environment.
I remember it was a shell command but I don't remember the command and I cannot find it. Please help
Upvotes: 17
Views: 13214
Reputation: 5833
This is the sequence I came up with recently (Apr 2020) to upgrade my vagrant box from 9.2.x to 9.5.x
If the VM is not running first do:
vagrant up
Then go into the VM:
vagrant ssh
and back up the databases:
mysqldump -u homestead --all-databases -p > homestead-backup.sql
copy the resulting file to the host machine (only if the above command was not run in a mapped folder)
Close the ssh connection:
exit
then run:
vagrant box update
vagrant destroy
vagrant box prune
Answer yes to all questions. Then
git fetch
git pull origin release
Start the VM again:
vagrant up
once it's started (it will take longer this time) go into the VM:
vagrant ssh
and restore the databases (copy the backup file over from the host if it was not in the mapped folder)
mysql -u homestead -p < homestead-backup.sql
Note: add -p if needed to mysql import and export, it will prompt for password (default: "secret")
Upvotes: 15
Reputation: 18117
First, check the available homestead releases:
https://github.com/laravel/homestead/releases
To check your homestead and vagrant versions use these commands:
vagrant version
I had Installed Version: 2.2.10, the last version for mac was 2.2.14
git branch -v
In my case, I had this output: HEAD detached at v11.4.0
Then, how to update Vagrant and Homestead?
First, make sure you backup the DB!
https://laravel.com/docs/8.x/homestead#database-backups
In my case, the automatic backup didn't work, and the first time I did the vagrant destroy I lost the DBs, so I suggest to backup manually like this:
vagrant ssh
mysqldump -u homestead -p --all-databases > homestead-20210214.sql
Then copy file out from the Vagrant machine before destroying: from ~/HomesteadÂ
scp -P 2222 [email protected]:/home/vagrant/homestead-20210214.sql .
Then from the Homestead directory:
vagrant destroy
git fetch
To check the version of your homestead:
vagrant box list
In my case, I had:
laravel/homestead (virtualbox, 10.1.1)
Here you can check the latest stable release of Homestead:
https://github.com/laravel/homestead/releases.
In my case was Homestead 12.
But actually what you are going to install is the latest stable release of the laravel/homestead Vagrant box.
You can see the latest release here.
https://app.vagrantup.com/laravel/boxes/homestead.
In my case was v11.0.0
Then since in my case, the latest Homestead was v12.0.0 I did:
git checkout v12.0.0
vagrant box update
bash init.sh
vagrant up
And you are done.
Then you can restore the DBs.
How if I run
vagrant box list
I see:
laravel/homestead (virtualbox, 11.0.0)
Have a look also at the official documentation here. https://laravel.com/docs/8.x/homestead#updating-homestead
Upvotes: 2
Reputation: 5738
First update your box:
vagrant box update
And, as it is documented here:
https://laravel.com/docs/master/homestead#updating-homestead
You should first destroy the machine and recreate it:
vagrant destroy
vagrant up
Just tested and it worked for me. (updated from homestead: '8.2.0' to '9.0.0')
Do not forget to backup your existing database datas before destroying the machine.
Upvotes: 3
Reputation: 41400
If you used a default settings on installation, you need
1) go to your vagrant folder
$ cd ~/Homestead/
2) run vagrant box update
command
$ vagrant box update "homestead-7"
Tested on Laravel 5.6/5.7
Upvotes: 1
Reputation: 2453
Use below command
homestead update
If this doesn't work
homestead box update
If this also doesn't work at all
This command will tell you the state of all active Vagrant environments on the system for the currently logged in user.
vagrant global-status
vagrant box update "laravel/homestead"
I hope i am clear now!
Upvotes: 6
Reputation: 954
Please follow this url which will guide you to update the laravel/homestead
also the basic steps is cd
into your homestead directory and run vagrant box update
it will download the latest version
Upvotes: 2