before installing homestead, you need to download the installation Git Bash, Vagrant, Virtual Box.
Note: Laravel's official recommended shell is git Bash. Because Git bash automatically maps the ~ (tilde) to the user root (for example, C:\Users\MyUserName), if you use the Windows-brought cmd, you need to use %HOMEDRIVE%%HOMEPATH% environment variables to enter the correct folder.
1: Open git bash to see if vagrant is installed successfully
2: Install Homestead
Automatically download and install the latest version of Homestead
Because the domestic network download speed is very slow, so manual download
: https://github.com/laravel/settler/releases/tag/v3.1.0
Modify the downloaded file to Homestead.box (the prefix is not important, but be sure to add the. box suffix)
File:///e:/homestead.box File Storage Path
When you're done, you'll find yourself in your user folder with a. Vagrant.d folder (C:\USERS\ADMINISTRATOR\.VAGRANT.D)
3: Cloning the Homestead configuration file
Generate a Homestead folder (C:\Users\Administrator\Homestead) under the user folder
4: Start initializing Homestead
Under the Homestead folder, open Homestead.yaml, configure Homestead
First we need to build SSH key and fill in the path
Upon completion, we will see a. ssh folder in the user's root directory, each with
Two files, respectively, in the corresponding configuration file
where folders, the folder behind the map (that is, ~/code) is mapped to/home/vagrant/code in Homestead. This is similar to the system shared folder we see in the virtual machine, we share this machine's ~/code folder to Homestead, so we can easily use our favorite IDE (such as phpstorm) for development, in ~/ The changes made in code will be reflected in the corresponding folder in Homestead.
In sites, we define the folder Homestead.app points to/home/vagrant/code/laravel/public, which is the public folder of the Laravel project. This allows you to enter Homestead.app in the browser so that we can see the project homepage directly.
Note: The above folders and mappings can be changed according to user preferences, such as I like to my development folder called Laraveldemo, in which I built a new project called Laravel, then the above configuration, I can make corresponding changes:
Next we will add a line of 192.168. Homestead. App in the Hosts file.
The Hosts file for Windows is in the following path: C:\ Windows\system32\drivers\etc\
Next, let's see.
Here, each time we add a database name, homestead will automatically create a database of that name for us to manipulate.
The default MySQL server user name is homestead, and the password is secret.
5: Save Homestead.yaml file, start vagrant
The laravel/homestead was not found because the homestead was manually installed and was C:\Users\Administrator\.vagrant.d\boxes\ under the user's root directory. Laravel-vagrantslash-homestead\0
Modify the Homestead.rb file under C:\Users\Administrator\Homestead\scripts
Re-enter Homestead vagrant up
We will see that the vagrant has run smoothly!
Next, to enter homestead, we enter
CD into our shared folder $ cd/home/vagrant/code
Create a new Laravel project $ laravel new Laravel
Installing Laravel/homestead under Windows