windows安装vagrant 以及 laravel homestead
之前一篇文章介绍了composer的安装,本篇介绍一下vagrant以及homestead的安装。
原文:ekan001.com/article/40
准备工作
VirtualBox 虚拟机,基础依赖 Vagrant 基于VirtualBox或vmware的虚拟化环境部署工具,可以将一个虚拟机打包(简称vbox)给别人。 Homestead laravel官方vbox,集成环境以及一套特制的命令行工具。 xshell 这是一款windows下的ssh & shell工具,同类的有securecrt、putty等。安装VirtualBox
这个安装比较简单,百度一下,下载安装即可。
安装Vagrant
到 https://www.vagrantup.com/downloads.html 下载,速度有点慢,忍受一下吧。安装过程同样傻瓜化,略过。
安装完以后重启一下,再打开cmd,vagrant --version 命令应该生效了。
下载Homestead vbox
通过命令
vagrant box add laravel/homestead https://atlas.hashicorp.com/laravel/boxes/homestead
可以自动下载homestead的vbox,然而国内网络大家懂的,龟速。
建议自己有vps的同学,在vps上通过
wget -O homestead.box https://atlas.hashicorp.com/laravel/boxes/homestead/versions/0.2.6/providers/virtualbox.box
手动下载后,再从vps上将box下载到本地,或者可以试试用迅雷下载。总之,想办法把这个box文件下载下来,然后通过以下命令添加到vagrant
vagrant box add ./homestead.box
./homestead.box 是box文件所在路径,我这里是直接 cd 到文件所在目录中执行命令的。
添加过程中可能会让你选virtualbox或vmware,很明显选virtualbox.其他默认即可。
安装homestead命令行工具
通过composer安装homestead命令行工具
composer global require "laravel/homestead=~2.0"
关于composer这块,前面一篇文章《windows安装composer》介绍的比较详细,不明白的可以去看一下。
然后执行
homestead init
会在 ~/.homestead/ 下面生成一个 Homestead.yaml 文件,你可以手动编辑它,也可以通过命令
homestead edit
编辑它。
配置
可以看到,Homestead.yaml 中有一系列参数,参数含义在laravel官方手册里介绍的比较详细,这里不再赘述。有什么不明白可以留言。
启动
通过cmd执行
homestead up
即可启动虚拟机。
连接ssh
打开 xshell ,创建一个新的链接:
地址:127.0.0.1 端口:2222 用户身份验证方式:public key 用户名:vagrant 用户密钥:通过ssh-keygen工具生成 id_rsa 文件。完结
整个环境搭建完毕,之后就开心写代码吧。

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics



Alipay PHP...

JWT is an open standard based on JSON, used to securely transmit information between parties, mainly for identity authentication and information exchange. 1. JWT consists of three parts: Header, Payload and Signature. 2. The working principle of JWT includes three steps: generating JWT, verifying JWT and parsing Payload. 3. When using JWT for authentication in PHP, JWT can be generated and verified, and user role and permission information can be included in advanced usage. 4. Common errors include signature verification failure, token expiration, and payload oversized. Debugging skills include using debugging tools and logging. 5. Performance optimization and best practices include using appropriate signature algorithms, setting validity periods reasonably,

Article discusses late static binding (LSB) in PHP, introduced in PHP 5.3, allowing runtime resolution of static method calls for more flexible inheritance.Main issue: LSB vs. traditional polymorphism; LSB's practical applications and potential perfo

Article discusses essential security features in frameworks to protect against vulnerabilities, including input validation, authentication, and regular updates.

The article discusses adding custom functionality to frameworks, focusing on understanding architecture, identifying extension points, and best practices for integration and debugging.

Sending JSON data using PHP's cURL library In PHP development, it is often necessary to interact with external APIs. One of the common ways is to use cURL library to send POST�...

The application of SOLID principle in PHP development includes: 1. Single responsibility principle (SRP): Each class is responsible for only one function. 2. Open and close principle (OCP): Changes are achieved through extension rather than modification. 3. Lisch's Substitution Principle (LSP): Subclasses can replace base classes without affecting program accuracy. 4. Interface isolation principle (ISP): Use fine-grained interfaces to avoid dependencies and unused methods. 5. Dependency inversion principle (DIP): High and low-level modules rely on abstraction and are implemented through dependency injection.

Session hijacking can be achieved through the following steps: 1. Obtain the session ID, 2. Use the session ID, 3. Keep the session active. The methods to prevent session hijacking in PHP include: 1. Use the session_regenerate_id() function to regenerate the session ID, 2. Store session data through the database, 3. Ensure that all session data is transmitted through HTTPS.
