How to update laravel/homestead? - laravel

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

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")

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!

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.

Please follow this url which will guide you to update the laravel/homestead
Update laravel homestead
also the basic steps is cd into your homestead directory and run vagrant box update it will download the latest version

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

First, check the available homestead releases:
https://github.com/laravel/homestead/releases
To check your homestead and vagrant versions use these commands:
for the Vagrant version:
vagrant version
I had Installed Version: 2.2.10, the last version for mac was 2.2.14
for the Homestead version, go to the folder ~\Homestead and:
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 vagrant#127.0.0.1:/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

Related

Vagrant command doesn't work without Sudo

I have installed homestead with Vagrant in my MacOS. I have installed all with Virtual Box, but when i try to use vagrant command in my terminal for running Virtual Machine appear this error:
The VirtualBox VM was created with a user that doesn't match the
current user running Vagrant. VirtualBox requires that the same user
be used to manage the VM that was created. Please re-run Vagrant with
that user. This is not a Vagrant issue.
I try with sudo vagrant up and it work but is not the best choice.
Anyone can help me?
There's a screenshot of the terminal Error:
Terminal Error with command vagrant up and vagrant ssh.
Try deleting .vagrant directory
rm -r .vagrant
I suspect you copied or moved project folder from one place to another.
Alternatively you need to update the creator_uid file in .vagrant/. Check out this blog post.

Vagrant. The box you're attempting to add doesn't support the provider you requested

I created a vagrant box using vagrant package , uploaded it and released it.
Then I did vagrant init <username>/<box> which created a Vagrantfile. I even appended the box version to the Vagrantfile.
Next I did vagrant up --provider virtualbox. This tries to get the box locally and then when it can't find it, i get the error:
The box you're attempting to add doesn't support the provider
you requested. Please find an alternate box or use an alternate
provider. Double-check your requested provider to verify you didn't
simply misspell it.
If you're adding a box from HashiCorp's Atlas, make sure the box is
released.
I have given virtualbox as the provider and virtual box works fine with other boxes I use.
Make sure you have virtualbox installed if you are using ubuntu.
sudo apt install virtualbox-qt
What I figured was that due to some reason vagrant had got corrupted. So doing a fresh install of vagrant did the trick.
Upgrading vagrant version through installing .deb version worked for me (download through vagrant website: https://www.vagrantup.com/downloads - choose tab "Debian" and install the package)
I suffered for 2 hours but I don't want anyone to suffer ;)
1 - access the terminal (sudo) and, remove vagrant files
$ rm -rf /opt/vagrant
$ rm -f /usr/bin/vagrant
2 - then install it again as it has probably been corrupted.
$ curl -O https://releases.hashicorp.com/vagrant/2.2.9/vagrant_2.2.9_x86_64.deb
3 - install vagrant
$ sudo apt install ./vagrant_2.2.9_x86_64.deb
4 - confirm by viewing the installed vagrant version
& vagrant --version
be happy

Error when Vagrant Up running?

I am using vagrant on Ubuntu 14.04 and the version of it is Vagrant 1.4.3. When I am tiring to up the vagrant, Its giving me following error every time.
Successfully added box 'precise64' with provider 'virtualbox'!
There are errors in the configuration of this machine. Please fix
the following errors and try again:
shell provisioner:
* The following settings shouldn't exist: run
My virtualbox version = 4.3.10_Ubuntur93012
Please help me on this its blocking my every workflow :(
Install the latest version of Vagrant on your Ubuntu machine (assuming 64-bit):
Remove your old version of Vagrant: sudo apt-get remove vagrant
Copy the Debian 64-bit download link from https://www.vagrantup.com/downloads.html
In your console, type wget, paste in the download link from step 2, and hit enter (should look like wget https://releases.hashicorp.com/vagrant/x.x.x/vagrant_x.x.x_x86_64.deb)
Enter sudo dpkg -i vagrant_x.x.x_x86_64.deb, where x.x.x is the current Vagrant version
Credits:
https://www.howtoforge.com/tutorial/ubuntu-vagrant-install-and-getting-started/
http://www.icchasethi.com/installing-latest-vagrant-and-virtualbox-version-on-ubuntu-12-01/

"Command not invoked properly" Setting up laravel homestead with Vagrant

I am trying to set up a a vagrant laravel homestead box. I have both vagrant and virtualbox installed on my Xubuntu 14.04 machine. To do this I'm running the following command
user#home: $ vagrant box add laravel/homestead
Then I get the following error
This command was not invoked properly. The help for this command is
available below.
Usage: vagrant box add <name> <url> [--provider provider] [-h]
I'm doing this exactly how the laravel and vagrant documentation shows. Why is this not working? Do I need a url?
Your syntax is correct for versions 1.5+.
If you older Vagrant you need go to https://vagrantcloud.com/<BOX_NAME>/versions and copy the full link to the latest active version of you box. (<BOX_NAME> in your case is laravel/homestead)
Then you can download like this:
vagrant box add 'laravel/homestead' https://vagrantcloud.com/laravel/homestead/version/9/provider/virtualbox.box --provider virtualbox
However I strongly advice to update your Vagrant for the latest one.

Vagrant 'box could not be found' error

I've installed Vagrant and VirtualBox to simulate Hadoop management (Apache Ambari). According to its installing documentation, i've done everything to create a vm (with 'vagrant up' command). I've installed manually lucid32 box file and placed it to the directory but it still says:
There are errors in the configuration of this machine. Please fix
the following errors and try again:
vm:
* The box 'lucid32' could not be found.
What am i doing wrong?
I was able to get a box up using the latest install following this process.
# From your home directory, install the template box
vagrant box add lucid32 http://files.vagrantup.com/lucid32.box
# From your project directory
vagrant init lucid32
vagrant up
Using Apache Ambari:
# clone from GitHub
git clone https://github.com/u39kun/ambari-vagrant.git
# Append these entries to ambari-vagrant/append-to-etc-hosts.txt
# ubuntu 12.4 hosts
192.168.12.101 u1201.ambari.apache.org u1201
192.168.12.102 u1202.ambari.apache.org u1202
192.168.12.103 u1203.ambari.apache.org u1203
192.168.12.104 u1204.ambari.apache.org u1204
192.168.12.105 u1205.ambari.apache.org u1205
192.168.12.106 u1206.ambari.apache.org u1206
192.168.12.107 u1207.ambari.apache.org u1207
192.168.12.108 u1208.ambari.apache.org u1208
192.168.12.109 u1209.ambari.apache.org u1209
192.168.12.110 u1210.ambari.apache.org u1210
# Modify your hosts file
sudo cat ambari-vagrant/append-to-etc-hosts.txt >> /etc/hosts
# Get up and running
cd ambari-vagrant/ubuntu12.4
vagrant up
There was a problem with the configuration of Vagrant. The error message(s)
are printed below:
vm:
* The box 'hashicorp/precise64' could not be found.
For me, this was a simple matter of using too old a version of vagrant (version 1.0.1).
Download the latest from: https://www.vagrantup.com/downloads.html
And then:
$ sudo dpkg -i vagrant_1.8.5_x86_64.deb

Resources