Window installation homestead Development Environment tutorial, windowhomestead

Source: Internet
Author: User

Window installation homestead Development Environment tutorial, windowhomestead

I. Resource preparation

Link: http://pan.baidu.com/s/1mh7qUBe password: p4wx

1. Put the virtualbox. box file in the C root directory.

2. Put the metadata. json file in the user directory of drive C. For example, my website is C: \ Users \ pc.

3. Git-2.9.3-64-bit.exe download installation, all the default is good.

4. Download and install vagrant_1.8.5.msi.

5. download and install the VirtualBox-5.1.4-110228-Win.exe.

 

II. Introduction

  1. What is vagrant?

VirtualBox is believed to have been used by many people. It is a virtualization software used to virtualize a computer on our computer, and VMware Workstation, kvm, xen and others are a kind of things (Hypervisor is a professional). However, it provides easy-to-use interfaces (also available in VMware) and supports various platforms (Linux, Win, Mac ), it is very lightweight and the most critical free, so it is widely used.

We usually use VirtualBox. The most common situation is that we use Windows on our computer. If we want to run Linux or Linux on our computer, we need to run Win online banking, QQ win only or something. Although there is something like wine, you can run Windows software in Linux, but there is a win system with poor stability, and the current computer configuration, there is no need to worry about the memory and CPU consumption of virtual machines. You don't need to worry about that. What's more, VirtualBox is so lightweight. In my personal experience, getting an xp Virtual Machine to run QQ consumes less resources than chrome or ff login webQQ, and how much Javascript is used in an awful way...

For programmers who are forced to use code every day, VirtualBox cannot simply use Q. What programmers are most involved in is code, and many projects may be implemented, I am engaged in java and php in the company. I will go home and play python or something. I want to experience the configuration of the new version of mongodb, nginx, Emacs, or vim, it is not allowed to determine which project the database of the previous version is mysql, and postgresql is used in the next version. So many things are all put together on one computer, it will surely be confused by the various configuration environments.

What should we do? It is best to have a clean development environment for each project, just for this project, but we cannot configure a computer for each project, assign A virtual machine to each project, and enable the Virtual Machine of A when developing A, so that each development environment is independent and clean. Another problem is that our project has multiple developers. How can we ensure that everyone's development environment is the same? You cannot click the mouse one by one to fill in the configuration parameters, install the software one by one after the building. This is too troublesome and too difficult for geek. What we want is to configure the environment only once, and then package the environment with the deliver for others. After the environment is obtained, it can be directly started. Is there anything like this? Yes, it must be. Vagrant is used to do this.

2. What is homestead?

Homestead marked in red the environment that laravel officially packed for us, that is, the first file virtualbox. box in resource preparation. It includes the following:

    • Ubuntu 16.04
    • Git
    • Python 7.0
    • Nginx
    • MySQL
    • MariaDB
    • Sqlite3
    • Postgres
    • Composer
    • Node (With PM2, Bower, Grunt, and Gulp)
    • Redis
    • Memcached
    • Beanstalkd

 

Iii. Installation Steps

Under Git bash

1. Enter vagrant box add metadata. json

2. Inputgit clone https://github.com/laravel/homestead.git Homestead

3. Inputbash init.sh

At this time, there will be an additional. homestead folder in your user directory, which contains a Homestead. yaml file. This is the homestead configuration file, which is often used in our daily development. Edit the file now

1 --- 2 # Virtual Machine ip address 3 ip: "192.168.10.10" 4 # allocated to virtual memory 5 memory: 2048 6 # Number of cpus 7 cpus: 2 8 provider: virtualbox 9 10 authorize: ~ /. Ssh/id_rsa.pub11 12 keys: 13 -~ /. Ssh/id_rsa14 15 # Set the shared folder between the host and the virtual machine 16 folders: 17 # host 18-map :~ /Code/test19 # Virtual Machine 20 to:/home/vagrant/Code/test21 # Set the domain name and access address 22 sites: 23-map: test. app24 to:/home/vagrant/Code/test/public25 # Database 26 databases: 27-homestead28 29 # blackfire: 30 #-id: foo31 # token: bar32 # client-id: foo33 # client-token: bar34 35 # ports: 36 #-send: 5000037 # to: 500038 #-send: 777739 # to: 77740 # protocol: udp

After editing, create the Code folder in the user directory, which creates a test folder. Then, bind the Virtual Machine IP address to the domain name. Edit the hosts in file C: \ Windows \ System32 \ drivers \ etc and add the following line: 192.168.10.10 test. app. (You may need to modify the File Permission to add)

4. Enter ssh-keygen

Display: Enter file in which to save the key (/c/Users/pc/. ssh/id_rsa ):

Whether you press enter directly, you will be asked to enter the password or press enter directly.

5. Enter vagrant up

6. Enter vagrant ssh

At this time, you have entered the virtual machine, create a Code folder, enter the Code and create a new test folder.

OK. the development environment of homestead has been matched.

Enter exit to exit the VM and enter vagrant halt to close the VM. Enter vagrant to view Common commands.

Yes

  

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.