环境介绍:
centtos6.5
vagrant:2.0.1
VirtualBox:5.1.30
1、添加box之后,设置了共享的目录之后,vagrant up 会出现以下的问题
Vagrant was unable to mount VirtualBox shared folders. This is usually
because the filesystem "vboxsf" is not available. This filesystem is
made available via the VirtualBox Guest Additions and kernel module.
Please verify that these guest additions are properly installed in the
guest. This is not a bug in Vagrant and is usually caused by a faulty
Vagrant box. For context, the command attempted was:
mount -t vboxsf -o uid=1000,gid=1000 vagrant /vagrant
The error output from the command was:
mount: unknown filesystem type ‘vboxsf‘
以上的问题是因为虚拟机没有装VBoxGuestAdditions,(增强组件)
ubuntu系统处理方案
sudo apt-get update
sudo apt-get install virtualbox-guest-utils
centos系统处理方案(mac版)
sudo yum update
sudo yum install gcc
sudo yum install kernel-devel
exit #退出虚拟机
vagrant halt # 关闭虚拟机
把上面的东西装成功之后,就要把增强组件的光盘挂载进来,然后执行安装的脚本就可以了
./VBoxLinuxAdditions.run
最后再重新执行一次 vagrant up就可以了。
--------------------------------------------------------------------------------
2、mac在文件同步之后可能会遇到文件权限的问题(mac系统就是这么的烦人)
设置方法:
config.vm.synced_folder "~/www/xcar/", "/export/home/",create:true,owner:"www",group:"www"
* 如果要是这么设置,那么在虚拟机中就一定要有这个用户和用户组(没有就去建立)
groupadd www,adduser www -g www
3、不能ssh登录的问题
首先检查防火墙是否关闭,
看selinux的详细状态,如果为enable则表示为开启
# /usr/sbin/sestatus -v
关闭selinux的方法:
/etc/sysconfig/selinux
SELINUX=disable