A previous article introduced the installation of composer, this article describes the installation of Vagrant and homestead.
Original: EKAN001.COM/ARTICLE/40
Preparatory work
- VirtualBox virtual machines, base dependent
- Vagrant A virtualized Environment deployment tool based on VirtualBox or VMware, you can package a virtual machine (referred to as VBox) to others.
- Homestead Laravel Official VBox, integrated environment, and a set of specially crafted command-line tools.
- Xshell This is a Windows SSH & Shell tool, similar to the SECURECRT, putty and so on.
Installing VirtualBox
This installation is relatively simple, Baidu a bit, download installation can.
Installing vagrant
To https://www.vagrantup.com/downloads.html
download, the speed is a bit slow, endure it. The installation process is equally silly and skipped.
After the installation, reboot, and then open cmd, the vagrant --version
command should take effect.
Download Homestead VBox
by command
vagrant box add laravel/homestead https://atlas.hashicorp.com/laravel/boxes/homestead
can automatically download Homestead VBox, but the domestic network you understand, turtle speed.
Recommend yourself to have VPS for classmates, on the VPS through
wget -O homestead.box https://atlas.hashicorp.com/laravel/boxes/homestead/versions/0.2.6/providers/virtualbox.box
Download it manually, then download it locally from the VPS, or try the Thunderbolt download. Anyway, find a way to download the box file and add it to vagrant with the following command
vagrant box add ./homestead.box
./homestead.box
is the path of the box file, I here is the direct CD to the directory where the file executes the command.
The addition process may allow you to choose VirtualBox or VMware, obviously choosing VirtualBox. Other default.
Installing the Homestead command-line tool
Installing the Homestead command-line tool via composer
composer global require "laravel/homestead=~2.0"
About composer This piece, the previous article "Windows installs the composer" The comparison detailed, does not understand can go to look.
And then execute
homestead init
~/.homestead/
a homestead.yaml file is generated below, you can edit it manually, or you can use the command
homestead edit
Edit it.
Configuration
You can see that Homestead.yaml
there are a series of parameters, the meaning of the parameters in the Laravel official manual described in more detail, here no longer repeat. What do not understand can leave a message.
Start
Execute with CMD
homestead up
To start the virtual machine.
Connect to SSH
Open the Xshell and create a new link:
- Address: 127.0.0.1
- Port: 2222
- User authentication method: Public key
- User name: vagrant
- User key: Generates a Id_rsa file from the Ssh-keygen tool.
End
The whole environment is finished, then happy to write code.
Windows installation vagrant and Laravel Homestead