尝试在Windows 7 64位主机上运行并调配具有Vagrant和Virtual Box的LAMP VM。但我收到错误消息:
Could not match ? at /tmp/vagrant-puppet/manifests/default.pp:2 on node lucid32.hsd1.ca.comcast.net.
搜索没有找到任何有用的线索 - 它们与使用Vagrant无关,并讨论完全不同的场景。
C:\Users\rdavis\lamp-project>vagrant up
[default] VM already created. Booting if it's not already running...
[default] Clearing any previously set forwarded ports...
[default] Forwarding ports...
[default] -- 22 => 2222 (adapter 1)
[default] -- 80 => 8080 (adapter 1)
[default] Creating shared folders metadata...
[default] Clearing any previously set network interfaces...
[default] Booting VM...
[default] Waiting for VM to boot. This can take a few minutes.
[default] VM booted and ready for use!
[default] Mounting shared folders...
[default] -- v-root: /vagrant
[default] -- configs: /configs
[default] -- manifests: /tmp/vagrant-puppet/manifests
[default] Running provisioner: Vagrant::Provisioners::Puppet...
[default] Running Puppet with /tmp/vagrant-puppet/manifests/default.pp...
stdin: is not a tty
Could not parse for environment production: Could not match ? at /tmp/vagrant-puppet/manifests/default.pp:2 on node lucid32.hsd1.ca.comcast.net.
The following SSH command responded with a non-zero exit status.
Vagrant assumes that this means the command failed!
cd /tmp/vagrant-puppet/manifests && puppet apply /tmp/vagrant-puppet/manifests/default.pp --detailed-exitcodes || [ $? -eq 2 ]
C:\Users\rdavis\lamp-project>
(一个子问题,好奇心是:什么是lucid32.hsd1.ca.comcast.net
?!这看起来像一个有效的URL(但实际上并不起作用(404)) - 那么它的用途是什么?)
我的设置:
发出命令:
vagrant box add base http://files.vagrantup.com/lucid32.box
然后尝试基于以下内容在Windows 7 64位主机中设置LAMP VM: http://ox86.tumblr.com/post/23734821654/painless-development-environments-with-virtualbox
......如下:
mkdir lamp-project
cd lamp-project
C:\Users\rdavis\lamp-project>mkdir configs
C:\Users\rdavis\lamp-project>mkdir manifests
C:\Users\rdavis\lamp-project>vagrant init
Edited Vagrantfile在Vagrant::Config.run do |config|
config.vm.box = “lucid32”
config.vm.provision :puppet do |puppet|
puppet.manifests_path = File.expand_path(“../manifests”, __FILE__)
end
config.vm.forward_port 80, 8080
config.vm.share_folder “configs”, “/configs”, File.expand_path(“../configs”, __FILE__)
然后创建了一个default.pp
木偶文件(同样来自参考1),并将manifests
文件夹作为参考1指示
$config_path = "/configs”
$vagrant_base_path = "/vagrant”
Exec { path => "/bin:/usr/bin:/usr/local/bin” }
group { "puppet”: ensure => present }
exec { "apt-get update”: command => "apt-get update” }
class apache {
file { "/etc/apache2/sites-enabled/000-default":
ensure => file,
source => "${config_path}/000-default",
before => Service["apache2"],
}
exec { "enable-mod_rewrite":
require => Package["apache2"],
before => Service["apache2"],
command => "/usr/sbin/a2enmod rewrite"
}
package { "apache2":
ensure => present,
before => File["/etc/apache2/sites-enabled/000-default"],
}
service { "apache2":
ensure => running,
require => Package["apache2"]
}
}
class php {
package { "libapache2-mod-php5": ensure => present }
package { "php5": ensure => present }
package { "php5-cli": ensure => present }
package { "php5-dev": ensure => present }
package { "php5-mysql": ensure => present }
package { "php-pear": ensure => present }
exec { "pear upgrade":
command => "/usr/bin/pear upgrade",
require => Package["php-pear"],
}
}
class mysql {
package { "mysql-server":
require => Exec["apt-get update"],
ensure => present,
}
service { "mysql":
enable => true,
ensure => running,
require => Package["mysql-server"],
}
exec { "Set MySQL server root password":
require => Package["mysql-server"],
unless => "/usr/bin/mysqladmin -uroot -proot status",
command => "/usr/bin/mysqladmin -uroot password root",
}
}
include apache
include php
include mysql
更新
一些无效的引用,例如见行$vagrant_base_path = "/vagrant”
”
的所有实例都已更正为"
答案 0 :(得分:1)
一些无效的引用,例如见行$ vagrant_base_path =“/ vagrant”
所有“已被更正为”的实例