您好,欢迎访问一九零五行业门户网

laravel-homestead环境搭建

composer安装
使用curl指令下载:culr -ss https://getcomposer.org/installer | php使用php指令下载:php -r readfile('https://getcomposer.org/installer'); | php或者手动下载composer.phar当你下载之后,需要配置环境变量,以便可以在任意路径下进行全局域操作 mv composer.phar /user/local/bin/composer
安装virtualbox虚拟机和vagrant管理工具
在启动你的 homestead 环境之前,你必须先安装
virtualbox 和vagrant. 两套软件在各平台都有提供易用的可视化安装程序。
添加vagrant盒子(此处盒子为homestead封装包,点击vagrant box可获取更多镜像盒子)
当 virtualbox / vmware 和 vagrant 安装完成后,你可以在终端机以下列命令将 'laravel/homestead' 封装包安装进你的 vagrant 安装程序中。下载封装包会花你一点时间,时间长短将依据你的网络速度决定:
vagrant box add laravel/homestead
如果网络正常就慢慢等待下载然后添加,这里由于网络的原因我试了很多次都失败了,最后直接复制下载链接
https://atlas.hashicorp.com/laravel/boxes/homestead/versions/0.2.7/providers/virtualbox.box下载保存到/path/tovirtualbox.box,然后通过
vagrant box add laravel/homestead /path/to/virtualbox.box
安装homestead命令行cli工具
箱子被添加到vagrant安装目录下后,通过 composer 的 global 指令来安装 homestead 命令行工具:
composer global require “laravel/homestead=~2.0”
homestead配置与初始化
安装了 homestead 命令行工具之后,执行 init 来创建 homestead.yaml 配置文件
homestead init生成的 homestead.yaml 文件将被放置于~/.homestead目录下。如果你使用的是 mac 或 linux 操作系统,还可以通过执行 homestead edit 指令来编辑 homestead.yaml 文件:homestead edit
启动vagrant盒子
根据实际情况编辑好“homestead.yaml”文件,就可以在终端上的homestead目录下执行homestead up 命令。
vagrant将启动虚拟机,并自动配置共享目录和nginx站点!不要忘记把你的nginx站点的“域”添加到机器里的hosts文件里!hosts文件将把对本地域的请求重定向到homestead环境里。
以上就介绍了laravel-homestead环境搭建,包括了require方面的内容,希望对php教程有兴趣的朋友有所帮助。
其它类似信息

推荐信息