安装vagrant//添加虚拟机使用命令vagrantboxaddlaravel/homestead//克隆homesteadgitclonehttps://github.com/laravel/homestead.git./homestead//初...
安装vagrant
//添加虚拟机
使用命令vagrant box add laravel/homestead
//克隆homestead
git clone https://github.com/laravel/homestead.git ./homestead
//初始化homestead
bash init.sh
//编辑homestead.ymal文件,添加站点、目录共享、指定php版本等
---
ip: "192.168.10.10"
memory: 4096
cpus: 1
provider: virtualbox
natdnshostresolver: off
authorize: ~/.ssh/id_rsa.pub
keys:
- ~/.ssh/id_rsa
folders:
- map: d:/code/api
to: /home/vagrant/api
- map: d:/code/b2b
to: /home/vagrant/b2b
- map: d:/code/swoole
to: /home/vagrant/swoole
- map: d:/code/nblbs
to: /home/vagrant/nblbs
- map: d:/code/nbdis
to: /home/vagrant/nbdis
sites:
- map: www.api.com
to: /home/vagrant/api/public
php: "7.2"
- map: www.b2b.com
to: /home/vagrant/b2b/public
php: "7.2"
- map: www.eswoole.com
to: /home/vagrant/swoole
php: "7.2"
- map: b2b.lbs.com
to: /home/vagrant/nblbs/public
php: "7.2"
- map: dis.lbs.com
to: /home/vagrant/nbdis/public
php: "7.2"
databases:
- homestead
# blackfire:
# - id: foo
# token: bar
# client-id: foo
# client-token: bar
# ports:
# - send: 7777
# to: 777
# protocol: udp
//启动vbox
vagrant up
//下载amqp需要的rabbitmq-c依赖
wget https://github.com/alanxz/rabbitmq-c/archive/v0.10.0.tar.gz
sudo mkdir build && cd build
sudo cmake -DCMAKE_INSTALL_PREFIX=/usr/local/rabbitmq-c ..
sudo cmake --build . --target install
//如出现以下错误
//collect2: error: ld returned 1 exit status
//Makefile:208: recipe for target 'amqp.la' failed
//检查/usr/local/rabbitmq-c/lib下的库文件是否存在子目录中,如果是需要复制到lib下
//下载amqp
wget http://pecl.php.net/get/amqp-1.9.4.tgz
tar -zxvf amqp-1.9.4.tg
cd amqp-1.9.4.tg
//指定php版本
sudo /usr/bin/phpize7.2
//指定php版本
./configure --with-php-config=/usr/bin/php-config7.2 --with-amqp --with-librabbitmq-dir=/usr/local/rabbitmq-c
//make&make install
sudo make && make install
//也可使用sudo pecl install amqp进行安装,安装时输入rabbitmq-c的编译安装目录
//检查pecl当前配置和修改配置
sudo pecl config-show
sudo pecl config-set ext_dir /usr/lib/php5/20131226
sudo pecl config-set php_dir /usr/share/php5
sudo pecl config-set php_bin /usr/bin/php5
全文详见:http://xpxw.com/?id=112