Because before a week on pit, later because the C disk burst moved to E disk (here is in E disk, for example, terminal using git, capture pictures with the laragon terminal, don't ask why because lazy), because of the past did not get, and wasted the time of day, so I record favored in the pit of his tread upon, Also hope to help the pit partners, although their own layout is lousy (steal a lazy row ~), but enough

Environment Building (WIN10)

The Laravel framework has its own heavyweight development environment: Homestead

1, Preparations: Virtual Box(Virtual machine), Git terminal, Vagrant (local development environment) download and one-click installation (Please refer to laravel Chinese community directly)

PS:

After installing the Virtual Box, don’t worry about adding the Box and modify itAfter installing Vagrant configure environment variables: My Computer Properties Advanced System Settings environment variables Step 1 is done

2. Go to the Vagrant website and download virtualBox. box (I have placed the downloaded file in E:/larall).

> cd /e/larall
Copy the code

1 year ago: Go to a git or CMD or Laragon or SourceTree terminal

Enter the command (this step can be ignored, a long time ago to step on the pit, there are new shortcuts below, to avoid wasting time download)

Note: the download is named as a string of code, so we need to rename it (change the name of the downloaded file to virtualbox.box).

The current method can be downloaded directly

Link: pan.baidu.com/s/1paOliB71… Please click to download virtualBox6.3.0.box file into the larall folder of E disk

3. Add the download box with Vagrant

> cd /e/larall
> vagrant box add 'Custom name'Virtualbox6.3.0. BoxCopy the code

Can be viewed by

> vagrant box list
Copy the code

Determines whether SSH files exist

> ll ~/.ssh
Copy the code

If you have id_rsa and id_rsa.pub files, proceed to the following steps. If you do not have id_rsa and id_Rsa. pub files, please refer to laravel

> cd /e/larall
> git clone https://git.coding.net/summerblue/homestead.git Homestead
> cdHomestead > Git checkout v7.8.0 > bash init.sh > ExplorerCopy the code

Find the homestead. yaml file to modify the relevant parameters, the parameters are detailed (please refer to laravel Chinese community directly), the following is my personal configuration

---
ip: "192.168.10.10"
memory: 2048
cpus: 1
provider: virtualbox

authorize: ~/.ssh/id_rsa.pub

keys:
    - ~/.ssh/id_rsa
    - ~/.ssh/id_rsa.pub

folders:
    - map: E:/larall/code/larashop
      to: /home/vagrant/code/larashop

sites:
    - map: larashop.test
      to: /home/vagrant/code/larashop/public

databases:
    - homestead
    - larashop

# blackfire:
# - id: foo
# token: bar
# client-id: foo
# client-token: bar

# ports:
# - send: 50000
# to: 5000
# - send: 7777
# to: 777
# protocol: udp

Copy the code

PS: Remember to run every time you modify the Homestead.yaml file

> cd /e/larall/Homestead
> vagrant reload --provision
Copy the code

If you cannot save the hosts file, please check the permission of Win. ① Go to the etc configuration path. ② Edit the hosts file and ③ Add the domain name

192.168.10.10 larashop. TestCopy the code

6. My vm and Vagrant are installed in the Larall folder. Make sure they are installed

> cdVagrant SSH /e/laralll/Homestead > Vagrant SSH /e/ Laralll /Homestead > Vagrant SSHCopy the code

Screenshots of high probability error cases

Error 1(This problem is a year ago, following the documents of Laravel Chinese community will not appear this problem) : Solution: Because the default setting of this VirtualBox system is 2.0.0 (currently my latest version points to 4.0.0) and our file is 0

  1. Open the Homestead\scripts\ Homestead. Rb file
  2. Find: config. Vm. Box_version = Settings (” version “) | | = “> = 2.0.0”
  3. To: config. Vm. Box_version = Settings (” version “) | | = “> = 0”

Error 2:

  1. Open the Homestead\scripts\ Homestead. Rb file
  2. Find: config. Vm. Box = Settings (” box “) | | = “lc/favored”
  3. To: config. Vm. Box = Settings (” box “) | | = “laravel/favored”

Windows 10 Install Homestead card on SSH Auth Method: Private key method 1: C:\Users\ your username. SSH folder exists, and there are two files id_rsa&id_rsa. pub, if not, use git to generate SSH key. Then copy id_RSA to homestead. vagrant\ Machines \ Homestead-7 \virtualbox\ as private_key and try again method 2: Solution 3: Repeat the tutorial twice

Common commands

vagrant -v          # check version
vagrant status      # check status
vagrant up          # Start the VM
vagrant ssh         # Access the VM
vagrant reload      # Restart the VM
vagrant suspend     # Suspend the VIRTUAL machine (the memory of the virtual machine is saved on the hard disk and can be quickly recovered after startup)
vagrant resume      # Restore virtual machine (corresponding to suspend)
vagrant halt        # Shut down the VM
vagrant destroy     Destroy the VIRTUAL machine
vagrant package     # Pack image (can be used anywhere in the future)

# box
vagrant box list    # mirror list
vagrant box add     # add mirror
vagrant box remove  # delete mirror
Copy the code