Home>Article>PHP Framework> How to install and build Homestead 2.0 environment on Mac
How to set up a Homestead environment on Mac? The following article will introduce to you how to install and build the Homestead 2.0 environment under the Mac version. I hope it will be helpful to you!
Homestead is one of Laravel's officially recommended development environments. It consists of a Homestead script that customizes VagrantHow to install and build Homestead 2.0 environment on Mac and a Vagrant box that contains PHP development-related software.
Note: This document is a note on installing Homestead 2.0 under Mac version 10.10. It requires a certain understanding of Homestead when reading. For instructions on Homestead, please see (https://learnku.com/laravel/ t/256).
1. Install Virtual Box
##Download (https://www.virtualbox.org/wiki/ Downloads) and install Virtual Box.2. Install Vagrant
Download (http://www.vagrantup.com/downloads.html) and install Vagrant.3. Download and add homestead box
Command line operation$ vagrant box add laravel/homesteadOutput In order to speed up the download, CTRL C interrupts the download and uses the multi-threaded download tool to download the link pointed to by cutting off the image above. After downloading, execute the following command to modify /path/to/ virtualbox.box is the correct path.
$ vagrant box add laravel/homestead /path/to/virtualbox.box
4. Install homestead command
composer global require "laravel/homestead=~2.0"
Please make sureAfter the installation is complete, execute the following command to test:~/. The composer/vendor/bin
directory is in your PATH.
homesteadConfiguration and initialization
1. Initializing homestead
$ homestead initwill generate
~/.homestead/Homestead.yamlHow to install and build Homestead 2.0 environment on Mac
2. Configure Homestead.yaml
Run the following command to edit the~/.homestead/Homestead.yamlHow to install and build Homestead 2.0 environment on Mac
$ homestead editSave after modification :
3. Add hosts
Execute the following command$ sudo vi /etc/hostsAppend
192.168.10.10 phphub.app
4. Initialize the homestead virtual machine
$ homestead upAfter the initialization is completed, visit the browser http://phphub.app Other information
Port mapping
Local address127.0.0.1Port corresponding
Connect to the database
The authentication for MySQL and Postgres is: homestead/secretLog in to the virtual machine
$ homestead ssh
The above is the detailed content of How to install and build Homestead 2.0 environment on Mac. For more information, please follow other related articles on the PHP Chinese website!