工作一直用的是别人打包好的虚拟机开发环境,感觉确实很酷。所以准备自己配个开发环境,为之后自己开发一些有趣的东西做准备。
ok,开始~~~
一、安装软件 vagrant和virtualbox
此处需注意:正常使用虚拟机需要开启电脑的VT功能(进入bios设置)
二、下载vagrant box文件。网址http://www.vagrantbox.es/,我选择下载了ubuntu box
三、在pc上建立你的工作文件夹,将box文件复制到该文件夹
四、参照网址操作https://segmentfault.com/a/1190000000264347
注意:若出现以下报错,可参考网址http://www.phperz.com/article/15/0604/132225.html安装virtualbox增强工具
==> default: Mounting shared folders...
sudo apt-get install php5-dev ,
default: /vagrant => E:/VmWork/ubuntu14.04
Failed to mount folders in Linux guest. This is usually because
the "vboxsf" file system is not available. Please verify that
the guest additions are properly installed in the guest and
can work properly. The command attempted was: mount -t vboxsf -o uid=`id -u vagrant`,gid=`getent group vagrant | cut -d: -f3` vagrant /vagrant
mount -t vboxsf -o uid=`id -u vagrant`,gid=`id -g vagrant` vagrant /vagrant The error output from the last command was: stdin: is not a tty
mount: unknown filesystem type 'vboxsf'
五、LNMP安装
第一步:vagrant ssh 进入虚拟机,设置root密码 sudo passwd ,更新列表和软件 sudo apt-get update,sudo apt-get upgrade
第二步:参照网址:http://www.cnblogs.com/ilanni/p/4631149.html安装
六、编译yaf框架
1.切换到root。命令 su
2.安装sudo apt-
get
install libncurses5-dev,sudo apt-get install libpcre3 libpcre3-dev
3.参考网址:http://www.linuxde.net/2013/07/14805.html(注意网页中获取yaf的网址是错误的,正确网址是:
http://pecl.php.net/get/yaf-2.2.9.tgz)
七、vagrant roload vagrantup 报错
错误1:The provider 'virtualbox' that was requested to back the machine 'default' is reporting that it isn'....
解决:改变pc的环境变量名为以下图片显示名。
错误2:The following SSH command responded with a non-zero exit status. Vagrant ass
解决:登陆虚拟机,在/etc/sudoers中添加