我有以下的
每次我运行
错误非常明显:"apache用户不存在"。据我所见,有两种或三种方法可以解决这个问题:
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用户不存在"。据我所见,有两种或三种方法可以解决这个问题:
- 通过从
synced_folder
中删除:owner => "apache",:group => "apache"
部分来解决问题。对于我来说,这是一个大问题,因为如果我将它们移除,那么文件夹将被vagrant
拥有,当apache尝试从/var/www/html
读取某些内容时,可能会引起问题。 - 通过注释掉
config.vm.synced_folder
,启动盒子让所有东西都安装和设置好,然后关闭盒子并再次启动未注释的行:它可以工作,但仍然是一个丑陋的解决方案。 - 通过强制在任何东西被安装之前进行配置:这是理想的解决方案。
是否有人知道是否可能实现第三个解决方案,如果是,该怎么做?我找不到任何关于第三个解决方案的信息:(如果您有更好的解决方案,欢迎在此发布,它可能会帮助我和其他人。