【问题标题】:Chef won't install apache2 in CentosChef 不会在 Centos 中安装 apache2
【发布时间】:2013-02-01 21:46:26
【问题描述】:

我试图通过在 Centos 盒子中创建 LAMP 堆栈来弄清楚 Chef 和 Vagrant 是如何工作的。 使用 Chef 进行配置时,Apache2 安装会出现以下错误:

[2013-02-01T11:00:13+00:00] INFO: package[apache2] installing httpd-2.2.15-15.el6.centos.1 from base repository

================================================================================

Error executing action `install` on resource 'package[apache2]'

================================================================================


Chef::Exceptions::Exec

----------------------

 returned 1, expected 0


Resource Declaration:

---------------------

# In /tmp/vagrant-chef-1/chef-solo-1/cookbooks/apache2/recipes/default.rb

 20: package "apache2" do
 21:   package_name node['apache']['package']
 22: end
 23: 

Compiled Resource:

------------------

# Declared in /tmp/vagrant-chef-1/chef-solo-1/cookbooks/apache2/recipes/default.rb:20:in `from_file'

package("apache2") do
  package_name "httpd"
  retries 0
  recipe_name "default"
  cookbook_name :apache2
  version "2.2.15-15.el6.centos.1"
  action :install
  retry_delay 2
end

[2013-02-01T11:00:56+00:00] ERROR: Running exception handlers
[2013-02-01T11:00:56+00:00] ERROR: Exception handlers complete
[2013-02-01T11:00:56+00:00] FATAL: Stacktrace dumped to /tmp/vagrant-chef-1/chef-stacktrace.out
[2013-02-01T11:00:56+00:00] FATAL: Chef::Exceptions::Exec: package[apache2] (apache2::default line 20) had an error: Chef::Exceptions::Exec:  returned 1, expected 0
Chef never successfully completed! Any errors should be visible in the
output above. Please fix your recipes so that they properly complete.

我注释掉了 Apache2 配方并尝试只安装 PHP,但这给出了同样的错误。然而,MYSQL 配方可以正常工作并且安装得很好

基本盒子是用 Veewee CentOS-6.3-i386-minimal 创建的,这是我使用的配方:

include_recipe "yum"
include_recipe "apache2"
include_recipe "apache2::mod_php5"
include_recipe "apache2::mod_rewrite"
include_recipe "php"
include_recipe "php::module_mysql"
include_recipe "mysql::server"

所有使用过的食谱都是opscode-cookbooks 的最新版本。 我不知道如何解决这个问题,是 yum 找不到软件包的错误,还是 de cookbooks 中的一些错误安装代码?

以前安装的 Debian 盒子和相同的食谱(Apt 而不是 Yum)可以正常工作。

感谢任何帮助。

【问题讨论】:

  • 登录到您要配置的服务器并尝试手动安装完全相同的httpd 软件包(包括完全相同的版本)。然后你会看到错误,为什么会失败。
  • @DracoAter 感谢您的帮助!

标签: php apache2 chef-infra vagrant yum


【解决方案1】:

感谢@DracoAter 的救命建议。

Ssh`d 进入 vagrant 并尝试使用 yum 手动安装软件包。 这给出了以下错误:

error: unpacking of archive failed on file /var/www/icons/poweredby.png;510bc31b: cpio: symlink

我的Vagrantfile中有这个:

config.vm.share_folder "www", "/var/www", "./www"

这显然会阻止 yum 访问该目录。因此,删除该行修复了httpd 的安装。

【讨论】:

  • 在我的情况下,安装的 yum 模块出现了问题,重新创建一个新的 vagrant box 有所帮助。
猜你喜欢
  • 2015-10-17
  • 2013-02-27
  • 2014-12-29
  • 2023-03-14
  • 1970-01-01
  • 2014-11-13
  • 2014-07-07
  • 1970-01-01
  • 2014-06-04
相关资源
最近更新 更多