vagrant 学习笔记

之所以学习他是因为最近换了电脑 又要重新搭环境  很烦躁然后就有了然后

1.先安装 virtualbox
2.安装 vagrant
3.安装xshell
4.重启
5.下载系统镜像 (可以去vagrant官网下载)
6.进入到镜像目录 执行 vagrant box add 名字 镜像名字
7.查看有没有box vagrant box list
8.初始化镜像 vagrant init 名字
9 开始虚拟机 vagrant up
10 登录 虚拟机 使用xshell登不进去 使用windows cmd 登录

11.共享文件

Vagrantfile增加配置

config.vm.network :private_network, type:"dhcp"
config.vm.synced_folder "D:/phpstudy/PHPTutorial/WWW/aa", "/aa" 前面路径是本地路径 后面路径是虚拟机路径
挂载过报错:mount -t vboxsf -o uid=1000,gid=1000 vagrant /vagrant
The error output from the command was:
mount: unknown filesystem type 'vboxsf'
解决办法:
vagrant plugin install vagrant-vbguest

vagrant reload --provision
12.打包分发
vagrant package --output ubuntu.box 后面ubuntu.box 是打包的名字
安装php+nginx环境
nginx安装教程:https://www.cnblogs.com/songxingzhu/p/8568432.html
php7.2 安装教程https://www.cnblogs.com/achengmu/p/9517337.html
安装swoole扩展
好一顿折腾
教程 https://wiki.swoole.com/wiki/page/6.html

vagrant 学习笔记

截图这个准备好。

 sudo /usr/local/php/bin/phpize 这里要写绝对路径执行
 sudo ./configure --with-php-config=/usr/local/php/bin/php-config 这里同上 

上面两步很关键

swoole安装好之后重启php-fpm就能看到了

未完待续。。。。。。。。。。。