Homestead 2.0 安装笔记
说明
此文档为 Mac 版本 10.10 下安装 Homestead 2.0 的笔记, 要求阅读时对 Homestead 有一定的了解, Homestead 的说明请见 这里.
安装
1. 安装 Virtual Box
下载 (链接) 并安装 Virtual Box.
2. 安装 Vagrant
下载 (链接) 并安装 Vagrant.
3. 下载并添加 homestead box
命令行运行
$ vagrant box add laravel/homestead
输出
为了加快下载速度, CTRL+C 中断下载, 把上图剪头指向的链接利用多线程下载工具下载.
下载后执行以下命令, 修改 /path/to/virtualbox.box 为正确的 path.
$ vagrant box add laravel/homestead /path/to/virtualbox.box
4. 安装 homestead 命令
composer global require "laravel/homestead=~2.0"
请确定
~/.composer/vendor/bin
目录在你的 PATH 里面.
安装完成后执行以下命令进行测试:
homestead
配置和初始化
1. 初始化 homestead
$ homestead init
会生成 ~/.homestead/Homestead.yaml
文件
2. 配置 Homestead.yaml
运行以下命令进行 ~/.homestead/Homestead.yaml
文件的编辑
$ homestead edit
修改后保存:
3. 添加 hosts
执行以下命令
$ sudo vi /etc/hosts
追加
192.168.10.10 phphub.app
4. 初始化 homestead 虚拟机
$ homestead up
初始化完成后, 访问浏览器 http://phphub.app
其他信息
端口映射
本地地址 127.0.0.1
端口对应
- SSH: 2222 → Forwards To 22
- HTTP: 8000 → Forwards To 80
- MySQL: 33060 → Forwards To 3306
- Postgres: 54320 → Forwards To 5432
连接数据库
MySQL 和 Postgres 的认证为: homestead / secret
登录虚拟机
$ homestead ssh
本帖已被设为精华帖!
@zwl1619 你再 mark 我就得封号啦, 兄弟.
@zwl1619 你可以用收藏功能 :sheep:
5.0的应该怎么安装啊```
折腾了一晚上,把环境搭建好了,但是访问Homestead.app的时候``
502 Bad Gateway
nginx/1.11.1
@HectorChan 我开始安装的时候,也遇到了这个问题
http://blog.leanote.com/post/wuliang/54c6d... 这是当时解决的方法,希望对你有帮助
@冷无缺 fpm配置文件的路径在哪里?
@HectorChan
fpm 路径:/etc/php/7.0/fpm/pool.d
nginx配置文件路径: /etc/nginx/sites-enabled 下有个以你网站域名命名的文件
@冷无缺 我有个疑惑,是在VM里面设置,还是本机上啊?
@HectorChan
1、homestead up 先启动虚拟机
2、homestead ssh 连接到虚拟机,在虚拟机里边设置
@冷无缺 好的,谢谢你,弄好了!!!
@HectorChan 你安装成功了没
有没有文档参考一下啊
$ vagrant box add laravel/homestead https://atlas.hashicorp.com/laravel/boxes/...
==> box: Loading metadata for box 'https://atlas.hashicorp.com/laravel/boxes/...'
==> box: Adding box 'laravel/homestead' (v0.5.0) for provider: virtualbox
box: Downloading: https://atlas.hashicorp.com/laravel/boxes/...
box:
The box failed to unpackage properly. Please verify that the box
file you're trying to add is not corrupted and try again. The
output from attempting to unpackage (if any):
@树哥 各位,我折腾一天了,始终出现上述错误
$ vagrant box list
There are no installed boxes! Use
vagrant box add
to add some.版本是 Vagrant 1.7.1
@HectorChan 我的改过了 还是报错 ,求帮助啊
@冷无缺 求教,我按照你说的改过了,也 sudo service restart nginx重启了nginx,
但是启动的时候还是说Failed to restart php7.1-fpm.service: Unit php7.1-fpm.service not found
@VShangxiao 你的php-fpm,重启失败了,报错日志,应该就能找到问题。估计你的路径还是不对
@冷无缺 求问,我已经按照你那篇 提示文章将fastcgi_pass unix:/var/run/php7.1-fpm.sock; 改成了 fastcgi_pass unix:/var/run/php7.0-fpm.sock; 然后就sudo service nginx restart 重启了nginx,但是vagrant reload --provision之后还是显示php7.1-fpm: unrecognized service?快崩溃了……
@VShangxiao 你装的PHP版本是7.1的吧,你现在改成了7.0的fpm,报错信息是找不到7.1的fpm。你先看看的PHP版本吧
2017-03-30 一路安装OK,唯独http报502错误
后来在
/etc/nginx/sites-enabled/homestead.app
中发现php-fpm的sock文件引用错误。原文是
/var/run/php5-fpm.sock
,很明显,都php7了,路径是不对的。手动查询后调整为
/var/run/php/php7.1-fpm.sock
,遂OK后来就看到你的回复啦~~~
@HectorChan
@Jamlee 你缺少第四行
升级 virtual Box 5.1 以后 vagrant就报错了~
@大力 想问下,我修改的时候报出权限错误,你没有遇到这个问题吗?我是 vagrant 的身份
F:\homestead>homestead init
[Symfony\Component\Console\Exception\CommandNotFoundException]
Command "init" is not defined.
这是什么问题?
直接homestead 显示 的好像和正常安装的不一样。。是homestead 错了吗
运行homestead up出现 stdin is not a tty 错误,是为什么呀?
laravel这些文档我也是醉了
真心醉了。homestead win10配置下一大堆错误。homestead装上了,又各种域名连不上。各种配置后都是连不上。解决方案都没有的论坛。。。。还敢说优雅的php框架????
下载后并且add添加box后,去up依旧自动去下载box了 咋办
这个怎么配置局域网访问啊?,这样改了 还是不行,启动报 NFS requires a host-only network to be created. Please add a host-only network to the machine (with either DHCP or a static IP) for NFS to work.