Install Homestead on Mac

Source: Internet
Author: User
Tags centos

Previously, a CentOS 7 virtual machine was installed with VirtualBox + Vagrant on Windows. After going home, the MAMP of the PHP integrated development environment on Mac was uninstalled, and a virtual machine was installed with VirtualBox + Vagrant, this time we used the box-Homestead officially encapsulated by Laravel.


I tried to install a CentOS 7 system on Mac for a long time. I used Alibaba Cloud host CentOS 7, but downloaded several box image files and set ip address access after installation, I always encountered various problems. I had to check the information and solve the problem. After I restarted my computer, I had to wait a few times and finally gave up. If I was unwilling to do so, I would have to fight again.

Homestead is based on the Ubuntu system. In fact, Homestead is also a good choice. It comes with PHP 7, nginx, mysq, php-fpm, redis, git, composer and other software used for PHP Development. After the software is configured and automatically started upon startup, it can be said that the software is directly developed after the installation and does not need to be concerned about the operating system environment.

Install Homestead trilogy on Mac:

1. Install VirtualBox + Vagrant Mac

Go to the official website to download and install the Mac version.

2. Download Homestead

It's too slow to install Homestead online. It's just as fast as it is. Use thunder. But how can I obtain the download address? There is a way to enter vagrant box add Laravel/homestead on the terminal and it will automatically find and download the image. At this time, the desired url will be displayed for download in the terminal, and copy the url to thunder.

3. Install with Vagrant

The steps for installing Homestead using Vagrant are no longer described.

Finally, what is the purpose of installing a virtual machine? In order to use it as a server, we still access it through ip addresses. We need to modify the Vagrantfile to take the modified part:


# Create a private network, which allows host-only access to the machine
# Using a specific IP.
Config. vm. network "private_network", ip: "192.168.10.31"
 
Config. vm. synced_folder ".../website", "/usr/share/nginx/html"
Set the access ip address of the VM to 192.168.10.31, and set the ing Directory. The previous address is the WEB directory on the Mac. I put all the URLs under the website, the next address is the nginx WEB directory in the VM.

For normal access, you need to set the nginx configuration file first. The nginx of Homestead does not have a configuration file by default. I added a www in the nginx configuration file directory. conf, and then save and restart the nginx service.

After modifying the file, run the command vagrant reload to restart the VM and access 192.168.10.31 in the browser.

In the future, you only need to enter vagrant up to start the VM, and the environment starts automatically, which is too convenient.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.