我有以下内容
Vagrantfile
:
# -*- mode: ruby -*-
# vi: set ft=ruby :
Vagrant.configure("2") do |config|
config.vm.box = "centos/6"
config.vm.provision :shell, :path => "bootstrap.sh"
config.vm.network :forwarded_port, host: 8080, guest: 80
config.vm.network :forwarded_port, host: 3306, guest: 3306
config.vm.synced_folder "../../applications", "/var/www/html", :owner=>"apache", :group=>"apache"
config.vm.provider :virtualbox do |vb|
vb.customize ["modifyvm", :id, "--memory", 2048]
vb.customize ["modifyvm", :id, "--natdnshostresolver1", "on"]
vb.customize ["modifyvm", :id, "--natdnsproxy1", "on"]
vb.name = "appserver"
end
end
每次我跑步
vagrant up
(这是我第一次跑步
vagrant destroy -f
)最后出现以下错误:
==> default: Mounting shared folders...
default: /vagrant => E:/Development/vagrant/centos6
default: /var/www/html => E:/Development/applications/arx
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:
id -u apache
The error output from the command was:
id: apache: No such user
错误很明显,“Apache用户不存在”。正如我看到的,有两种或三种方法可以解决这个问题:
-
通过移除
:owner=>"apache", :group=>"apache"
部分来自
synced_folder
. 这是一个
大的
不,至少对我来说是这样,因为如果我删除它们,文件夹将归
vagrant
当Apache试图从
/var/www/html
.
-
通过评论这句话
config.vm.synced_folder
,启动该设备,以便安装和设置所有设备,然后关闭该设备,并再次启动未注释的行:它可以工作,但仍然是一个丑陋的解决方案。
-
通过强制在装载任何东西之前进行资源调配:理想的解决方案。
有人知道这是否可行,如果可以,怎么办?我找不到关于第三个解决方案的任何内容:(如果你有更好的解决方案,那么欢迎你在这里发表文章,这可能会帮助我和其他人。
我找到了
this
和
this
但没有帮助。