Configure homestead and laravel development environments in Windows 8

Source: Internet
Author: User
Tags ssh access
: This article describes how to configure the homestead and laravel development environments in Windows 8. For more information about PHP tutorials, see. Prepare tools

In general, it is very difficult to configure the development environment on windows. The emergence of vagrant is a benefit of our developers. It greatly reduces the complexity of our configuration, but although it is mitigated, we still need to configure some. Let's not talk much about it. let's start with the question. First of all, let's talk about what we need: 1. windows has installed git. if not, click here 2. you need to install php (only php is required, and no other php is required. enable openssl extension in ini ). 3. then composer, vagrant, virtualbox, and homestead are required. The above is all the software required to configure the environment. next we will configure the environment.

Configuration process

In short, Homestead is a virtualbox-based linux virtual machine pre-encapsulated by laravel. a series of software Nginx, PHP 5.6, MySQL, IPVs, Redis, and Memcached have been installed on this virtual machine, sufficient for laravel development. This virtual machine can be easily started, destroyed, and rebuilt. Basically, it won't mess up your existing operating system. The following describes the installation process:

Install Composer

Composer is a php dependency management tool that can easily manage a series of extensions required during laravel development. Is a very important tool. Directly open the downloaded installation package and install it. if an error occurs, it is estimated that ssl is not enabled in php. you can install it again.

Install Vagrant and VirtualBox

Both are installed on the GUI. It should be noted that you need to enable hardware virtual attachment support (VT-X) to use Virtualbox, enable in BIOS.

Configure virtual machines

The required software is basically installed, and the next step is to configure the virtual machine. 1. add homestead to virtualbox and run the following code on the terminal (path is the path for placing homestead on your own ): shell vagrant box add laravel/homestead path\homestead.box2. install the homestead command line tool: shell composer global require "laravel/homestead=~2.0"Generally, an ssl error occurs here. this is caused by our special national conditions. you know, the solution is to use a domestic image and use the composer method here. add a domestic image in the json file and run the above code again to complete the installation.

  • Initialize homesteadshell homestead initAfter Execution, the configuration files of C: \ Users \. homestead and homestead are generated.

  • Modify Homestead. yaml

    "Shell

    ip: "192.168.10.10"memory: 2048cpus: 2authorize: ~/.ssh/id_rsa.pubkeys:    - ~/.ssh/id_rsafolders:    - map: ~/LaravelWorkspace      to: /home/vagrant/Codesites:    - map: homestead.app      to: /home/vagrant/Code/laravel/public          hhvm: truedatabases:    - homesteadvariables:    - key: APP_ENV      value: local

    "LaravelWorkspace is a code sharing Area. the changes made here are immediately reflected in the virtual machine. Others include site and database configurations. for details, go to laravel's official website to view details. Then the above ssh key is generated through gitbash, as follows:

    shell ssh-keygen -t rsa -C "your@email.com"The site needs to add the following configuration in the windows C: \ Windows \ System32 \ drivers \ etc \ hosts file:shell 192.168.10.10 homestead.app

  • Start a VM

    shell homestead upAfter executing the code for a while, you can see that the virtual machine is started and thenhttp://homestead.app:8000Or192.168.10.10Go to the homepage of your laravel project.

  • Homestead ssh problems

    The environment has been configured in the previous step, but on windows, the command line capability is really limited and there is no way to support the development requirements, because windows command line does not support ssh access. This is indeed a pain point. You can also use other ssh tools to access the virtual machine (both the user name and password are vagrant ). here we recommend a more powerful tool, chrome's secure shell. I have never seen it on a Web terminal. This makes it easy to access ssh, and our development needs are basically met here.

    The preceding section describes how to configure the homestead and laravel development environments in Windows 8, including related content. if you are interested in the PHP Tutorial.

    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.