Home > PHP Framework > Laravel > body text

How to install and build Homestead 2.0 environment on Mac

青灯夜游
Release: 2021-12-23 11:08:38
forward
2105 people have browsed it

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

Installation

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/homestead
Copy after login
Output

How to install and build Homestead 2.0 environment on Mac

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
Copy after login

4. Install homestead command

composer global require "laravel/homestead=~2.0"
Copy after login
Please make sure

~/. The composer/vendor/bin directory is in your PATH.

After the installation is complete, execute the following command to test:

homestead
Copy after login
Configuration and initialization

1. Initializing homestead

$ homestead init
Copy after login
will generate

~/.homestead/Homestead.yaml How to install and build Homestead 2.0 environment on Mac

2. Configure Homestead.yaml

Run the following command to edit the

~/.homestead/Homestead.yaml How to install and build Homestead 2.0 environment on Mac

$ homestead edit
Copy after login
Save after modification :


How to install and build Homestead 2.0 environment on Mac

3. Add hosts

Execute the following command

$ sudo vi /etc/hosts
Copy after login
Append

192.168.10.10    phphub.app
Copy after login

4. Initialize the homestead virtual machine

$ homestead up
Copy after login
After the initialization is completed, visit the browser http://phphub.app

Other information

Port mapping

Local address

127.0.0.1Port corresponding

    SSH: 2222 → Forwards To 22
  • HTTP: 8000 → Forwards To 80
  • MySQL: 33060 → Forwards To 3306
  • Postgres: 54320 → Forwards To 5432

Connect to the database

The authentication for MySQL and Postgres is: homestead/secret

Log in to the virtual machine

$ homestead ssh
Copy after login

                                                                                                           

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!

Related labels:
source:learnku.com
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!