首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >无法在主厨客户端(节点)上安装httpd服务

无法在主厨客户端(节点)上安装httpd服务
EN

Stack Overflow用户
提问于 2015-07-08 12:57:40
回答 2查看 1.7K关注 0票数 0

我是新的厨师,并遵循“学习厨师”的书从“奥里利”学习厨师的基本知识。在其第07章中,他们描述了如何使用食谱在厨师客户端(节点)上安装httpd服务。

这就是我的.kitchen.yaml文件的样子:

代码语言:javascript
复制
 ---
driver:
  name: vagrant

provisioner:
  name: chef_zero

platforms:
  - name: centos_apache
    driver:
     box: learningchef/centos65
     boxurl: learningchef/centos65

suites:
  - name: default
    run_list:
      - recipe[my_apache::default]
    attributes:

安装httpd服务的配方如下所示:

代码语言:javascript
复制
#
# Cookbook Name:: my_apache
# Recipe:: default
#
# Copyright (c) 2015 The Authors, All Rights Reserved.
#

yum_package 'httpd' do
  source "/home/vipul/Downloads/httpd-2.2.15-39.el6.centos.x86_64.rpm"
  action :install
end

这是我在执行命令“厨房会聚”后得到的日志。

代码语言:javascript
复制
-----> Starting Kitchen (v1.4.0)
-----> Converging <default-centos-apache>...
       Preparing files for transfer
       Preparing dna.json
       Preparing current project directory as a cookbook
       Removing non-cookbook files before transfer
       Preparing validation.pem
       Preparing client.rb
-----> Chef Omnibus installation detected (install only if missing)
       Transferring files to <default-centos-apache>
       Starting Chef Client, version 12.4.0
       [2015-07-08T12:56:06+00:00] WARN: Child with name 'dna.json' found in multiple directories: /tmp/kitchen/dna.json and /tmp/kitchen/dna.json
       resolving cookbooks for run list: ["my_apache::default"]
       Synchronizing Cookbooks:
         - my_apache
       Compiling Cookbooks...
       Converging 1 resources
       Recipe: my_apache::default


           ================================================================================
           Error executing action `install` on resource 'yum_package[httpd]'
           ================================================================================

           Mixlib::ShellOut::ShellCommandFailed
           ------------------------------------
           Expected process to exit with [0], but received '1'
           ---- Begin output of /usr/bin/python /opt/chef/embedded/apps/chef/lib/chef/provider/package/yum-dump.py --options --installed-provides --yum-lock-timeout 30 ----
           STDOUT: [option installonlypkgs] kernel kernel-bigmem installonlypkg(kernel-module) installonlypkg(vm) kernel-enterprise kernel-smp kernel-debug kernel-unsupported kernel-source kernel-devel kernel-PAE kernel-PAE-debug
           Could not retrieve mirrorlist http://mirrorlist.centos.org/?release=6&arch=x86_64&repo=os error was
           14: PYCURL ERROR 7 - "Failed to connect to 2a02:2498:1:3d:5054:ff:fed3:e91a: Network is unreachable"
           STDERR: yum-dump Repository Error: Cannot find a valid baseurl for repo: base
           ---- End output of /usr/bin/python /opt/chef/embedded/apps/chef/lib/chef/provider/package/yum-dump.py --options --installed-provides --yum-lock-timeout 30 ----
           Ran /usr/bin/python /opt/chef/embedded/apps/chef/lib/chef/provider/package/yum-dump.py --options --installed-provides --yum-lock-timeout 30 returned 1

           Resource Declaration:
           ---------------------
           # In /tmp/kitchen/cache/cookbooks/my_apache/recipes/default.rb

             8: yum_package 'httpd' do
             9:   source "/home/vipul/Downloads/httpd-2.2.15-39.el6.centos.x86_64.rpm"
            10:   action :install
            11: end

           Compiled Resource:
           ------------------
           # Declared in /tmp/kitchen/cache/cookbooks/my_apache/recipes/default.rb:8:in `from_file'

           yum_package("httpd") do
             action :install
             retries 0
             retry_delay 2
             default_guard_interpreter :default
             package_name "httpd"
             source "/home/vipul/Downloads/httpd-2.2.15-39.el6.centos.x86_64.rpm"
             flush_cache {:before=>false, :after=>false}
             declared_type :yum_package
             cookbook_name "my_apache"
             recipe_name "default"
           end


       Running handlers:
       [2015-07-08T12:56:14+00:00] ERROR: Running exception handlers
       Running handlers complete
       [2015-07-08T12:56:14+00:00] ERROR: Exception handlers complete
       Chef Client failed. 0 resources updated in 11.596431753 seconds
       [2015-07-08T12:56:14+00:00] FATAL: Stacktrace dumped to /tmp/kitchen/cache/chef-stacktrace.out
       [2015-07-08T12:56:14+00:00] ERROR: yum_package[httpd] (my_apache::default line 8) had an error: Mixlib::ShellOut::ShellCommandFailed: Expected process to exit with [0], but received '1'
       ---- Begin output of /usr/bin/python /opt/chef/embedded/apps/chef/lib/chef/provider/package/yum-dump.py --options --installed-provides --yum-lock-timeout 30 ----
       STDOUT: [option installonlypkgs] kernel kernel-bigmem installonlypkg(kernel-module) installonlypkg(vm) kernel-enterprise kernel-smp kernel-debug kernel-unsupported kernel-source kernel-devel kernel-PAE kernel-PAE-debug
       Could not retrieve mirrorlist http://mirrorlist.centos.org/?release=6&arch=x86_64&repo=os error was
       14: PYCURL ERROR 7 - "Failed to connect to 2a02:2498:1:3d:5054:ff:fed3:e91a: Network is unreachable"
       STDERR: yum-dump Repository Error: Cannot find a valid baseurl for repo: base
       ---- End output of /usr/bin/python /opt/chef/embedded/apps/chef/lib/chef/provider/package/yum-dump.py --options --installed-provides --yum-lock-timeout 30 ----
       Ran /usr/bin/python /opt/chef/embedded/apps/chef/lib/chef/provider/package/yum-dump.py --options --installed-provides --yum-lock-timeout 30 returned 1
       [2015-07-08T12:56:14+00:00] FATAL: Chef::Exceptions::ChildConvergeError: Chef run process exited unsuccessfully (exit code 1)
>>>>>> Converge failed on instance <default-centos-apache>.
>>>>>> Please see .kitchen/logs/default-centos-apache.log for more details
>>>>>> ------Exception-------
>>>>>> Class: Kitchen::ActionFailed
>>>>>> Message: SSH exited (1) for command: [sh -c '

sudo -E /opt/chef/bin/chef-client --local-mode --config /tmp/kitchen/client.rb --log_level auto --force-formatter --no-color --json-attributes /tmp/kitchen/dna.json --chef-zero-port 8889
']
>>>>>> ----------------------

我希望使用本地rpm包安装httpd服务。厨师客户端已经安装在虚拟机上。我尝试过不同的步骤,但输出总是相同的。

更新:所以我在我的主机和客户端都进行了yum更新。之后,输出日志更改了..。我说它无法在定义的源中找到包,而它却存在于其中。请建议:

代码语言:javascript
复制
-----> Starting Kitchen (v1.4.0)
-----> Converging <default-centos-apache>...
       Preparing files for transfer
       Preparing dna.json
       Preparing current project directory as a cookbook
       Removing non-cookbook files before transfer
       Preparing validation.pem
       Preparing client.rb
-----> Chef Omnibus installation detected (install only if missing)
       Transferring files to <default-centos-apache>
       Starting Chef Client, version 12.4.0
       [2015-07-09T14:16:57+00:00] WARN: Child with name 'dna.json' found in multiple directories: /tmp/kitchen/dna.json and /tmp/kitchen/dna.json
       resolving cookbooks for run list: ["my_apache::default"]
       Synchronizing Cookbooks:
         - my_apache
       Compiling Cookbooks...
       Converging 1 resources
       Recipe: my_apache::default


           ================================================================================
           Error executing action `install` on resource 'yum_package[httpd]'
           ================================================================================

           Chef::Exceptions::Package
           -------------------------
           Package httpd not found: /home/vipul/Downloads/httpd-2.2.15-39.el6.centos.x86_64.rpm

           Resource Declaration:
           ---------------------
           # In /tmp/kitchen/cache/cookbooks/my_apache/recipes/default.rb

             8: package "httpd" do
             9:   source "/home/vipul/Downloads/httpd-2.2.15-39.el6.centos.x86_64.rpm"
            10:   action :install
            11: end

           Compiled Resource:
           ------------------
           # Declared in /tmp/kitchen/cache/cookbooks/my_apache/recipes/default.rb:8:in `from_file'

           yum_package("httpd") do
             action :install
             retries 0
             retry_delay 2
             default_guard_interpreter :default
             package_name "httpd"
             source "/home/vipul/Downloads/httpd-2.2.15-39.el6.centos.x86_64.rpm"
             flush_cache {:before=>false, :after=>false}
             declared_type :package
             cookbook_name "my_apache"
             recipe_name "default"
           end


       Running handlers:
       [2015-07-09T14:17:01+00:00] ERROR: Running exception handlers
       Running handlers complete
       [2015-07-09T14:17:01+00:00] ERROR: Exception handlers complete
       Chef Client failed. 0 resources updated in 6.822340816 seconds
       [2015-07-09T14:17:01+00:00] FATAL: Stacktrace dumped to /tmp/kitchen/cache/chef-stacktrace.out
       [2015-07-09T14:17:01+00:00] ERROR: yum_package[httpd] (my_apache::default line 8) had an error: Chef::Exceptions::Package: Package httpd not found: /home/vipul/Downloads/httpd-2.2.15-39.el6.centos.x86_64.rpm
       [2015-07-09T14:17:01+00:00] FATAL: Chef::Exceptions::ChildConvergeError: Chef run process exited unsuccessfully (exit code 1)
>>>>>> Converge failed on instance <default-centos-apache>.
>>>>>> Please see .kitchen/logs/default-centos-apache.log for more details
>>>>>> ------Exception-------
>>>>>> Class: Kitchen::ActionFailed
>>>>>> Message: SSH exited (1) for command: [sh -c '

sudo -E /opt/chef/bin/chef-client --local-mode --config /tmp/kitchen/client.rb --log_level auto --force-formatter --no-color --json-attributes /tmp/kitchen/dna.json --chef-zero-port 8889
']
>>>>>> ----------------------
EN

回答 2

Stack Overflow用户

回答已采纳

发布于 2015-07-14 14:19:47

这个问题的答案是马克对问题的评论。所以就把它贴在这里。

终端代理是不够的。厨房在虚拟机中运行厨师客户端。请参阅:with#

票数 0
EN

Stack Overflow用户

发布于 2015-07-09 00:14:13

如果无法解决代理/网络问题,可能需要尝试遵循这里概述的步骤。http://xmodulo.com/how-to-fix-yum-errors-on-centos-rhel-or-fedora.html

致以敬意,

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/31293426

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档