Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to install and build Homestead 2.0 environment under Mac

2025-03-29 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/02 Report--

This article mainly introduces "how to install and build Homestead 2.0 environment under Mac". In daily operation, I believe many people have doubts about how to install and build Homestead 2.0 environment under Mac. Xiaobian consulted all kinds of information and sorted out simple and easy operation methods. I hope to help you answer the doubts about "how to install and build Homestead 2.0 environment under Mac"! Next, please follow the small series to learn together!

Homestead is one of Laravel's official recommended development environments, consisting of Homestead scripts for custom Vagrantfiles and Vagrant boxes containing PHP development related software.

Note: This document is a note for installing Homestead 2.0 under Mac version 10.10. It is required to have a certain understanding of Homestead when reading it. For instructions on Homestead, please see https://learnku.com/laravel/t/256.

installation

1. Installing 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, run

$ vagrant box add laravel/homestead

To speed up the download, CTRL+C interrupts the download and cuts the link to the top using the multithreaded download tool.

After downloading, execute the following command to modify/path/to/virtualbox.box to the correct path.

$ vagrant box add laravel/homestead /path/to/virtualbox.box

4. Install homestead command

composer global require "laravel/homestead=~2.0"

Make sure the ~/.composer/vendor/bin directory is in your PATH.

After installation, execute the following command to test:

Homestead configuration and initialization

1. Initialize homestead

$ homestead init

The ~/.homestead/Homestead.yaml file is generated

2. Configure Homestead.yaml

Run the following command to edit the ~/.homestead/Homestead.yaml file

$ homestead edit

save if modified

3. Add hosts

execute the following command

$ sudo vi /etc/hosts

additional

192.168.10.10 phphub.app

4. Initialize homestead virtual machine

$ homestead up

After initialization, visit the browser http://phphub.app

other information

port mapping

Local address 127.0.0.1 Port correspondence

SSH: 2222 → Forwards To 22

HTTP: 8000 → Forwards To 80

MySQL: 33060 → Forwards To 3306

Postgres: 54320 → Forwards To 5432

connect to the database

MySQL and Postgres are certified as: homestead / secret

log in to the virtual machine

$ homestead ssh This is the end of the study on "How to install and build Homestead 2.0 environment under Mac", hoping to solve everyone's doubts. Theory and practice can better match to help everyone learn, go and try it! If you want to continue learning more relevant knowledge, please continue to pay attention to the website, Xiaobian will continue to strive to bring more practical articles for everyone!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report