使用Vagrant的LEMP堆栈 - 无法安装Php5-fpm / Nginx?

时间:2015-02-02 11:21:55

标签: php ubuntu nginx vagrant puppet

我对Vagrant很新,但我正在尝试使用Puppet基于this进行Vagrant设置,但是基于Linux 14.04而不是12.04。但是,将VM更改为“ubuntu / trusty64”会导致安装失败。 据我所知,它无法在某处进行Nginx或PHP5-fpm安装。

运行vagrant up后收到以下错误消息,当我转到本地服务器时,收到“欢迎使用Nginx!”页:

(请告诉我是否应发布整件事,这只是我在终端上看到的错误消息)

==> default: Error: /Stage[main]/Php5-fpm/File[/etc/php5/fpm/php.ini]: Could not evaluate: Could not retrieve information from environment production source(s) puppet:///php5-fpm/php.ini
==> default: Error: /Stage[main]/Php5-fpm/File[/etc/php5/fpm/pool.d/www.conf]: Could not evaluate: Could not retrieve information from environment production source(s) puppet:///php5-fpm/www.conf

...

==> default: Notice: /Stage[main]/Wordpress::Setup_db/Exec[create-user]/returns: ERROR 1064 (42000) at line 1: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '* to @localhost identified by ""' at line 1
==> default: Error: mysql -uroot -pvagrant --execute 'grant all on .* to @localhost identified by ""' returned 1 instead of one of [0]
==> default: Error: /Stage[main]/Wordpress::Setup_db/Exec[create-user]/returns: change from notrun to 0 failed: mysql -uroot -pvagrant --execute 'grant all on .* to @localhost identified by ""' returned 1 instead of one of [0]

(我确实试图在这里纠正语法,摆脱错误,但它并没有影响更大的问题)

...

==> default: Error: /Stage[main]/Nginx/File[/etc/nginx/nginx.conf]: Could not evaluate: Could not retrieve information from environment production source(s) puppet:///nginx/nginx.conf

...

==> default: Notice: /Stage[main]/Nginx/Service[nginx]: Dependency File[/etc/nginx/nginx.conf] has failures: true
==> default: Warning: /Stage[main]/Nginx/Service[nginx]: Skipping because of failed dependencies

...

==> default: Notice: /Stage[main]/Php5-fpm/Service[php5-fpm]: Dependency File[/etc/php5/fpm/pool.d/www.conf] has failures: true
==> default: Notice: /Stage[main]/Php5-fpm/Service[php5-fpm]: Dependency File[/etc/php5/fpm/php.ini] has failures: true
==> default: Warning: /Stage[main]/Php5-fpm/Service[php5-fpm]: Skipping because of failed dependencies

...

The SSH command responded with a non-zero exit status. Vagrant
assumes that this means the command failed. The output for this command
should be in the log above. Please read the output to determine what
went wrong.

知道为什么这适用于hashicorp / precise64框,但不适用于ubuntu / trusty64? 我猜它是在php / nginx的设置中,但我无法弄清楚为什么。我的文件与this设置中的文件完全相同。

谢谢!

1 个答案:

答案 0 :(得分:0)

核心问题是Puppet版本的不同。

Ubuntu 12.04 LTS精确(Vagrant box' hashicorp / precise64'):

root@lemp:~# puppet --version
2.7.19
root@lemp:~#

Ubuntu 14.04 LTS Trusty(Vagrant box' ubuntu / trusty64'):

root@lemp:~# puppet --version
3.4.3
root@lemp:~#

当我在Precise上配置时,我收到了一些折旧警告:

  

==>默认值:警告:动态查找$ mysql_user at /tmp/vagrant-puppet/modules-7de194db6a79aa7dabd1c451463ec16b/wordpress/manifests/init.pp:22   已弃用。有关更多信息,请参阅   http://docs.puppetlabs.com/guides/scope_and_puppet.html。看到了   改变行为,使用--debug标志。

我已经将您链接的repo分叉并提交了解决折旧问题的非常基本的更改,并允许它与ubuntu / trusty64 vagrant框一起使用。您可以找到代码here

如果您只想查看差异,请查看this commit

注意:我在Vagrantfile中使用了一些Vagrant插件,我建议您也使用它们。

编辑:我也创建了这个pull request