Amazon ec2 gem安装刀-ec2错误

Amazon ec2 gem安装刀-ec2错误,amazon-ec2,chef-infra,knife,Amazon Ec2,Chef Infra,Knife,我已经在centos机器上安装了一个chef服务器,并且还在另一台centos机器上设置了一个工作站 我也把刀放好了。现在我想安装knife-ec2插件 我正在尝试安装刀插件,但出现以下错误: [root@ip-server-ip- chef-repo]# /opt/chef/embedded/bin/gem install knife-ec2 Building native extensions. This could take a while... Building nokogiri us

我已经在centos机器上安装了一个chef服务器,并且还在另一台centos机器上设置了一个工作站

我也把刀放好了。现在我想安装knife-ec2插件

我正在尝试安装刀插件,但出现以下错误:

[root@ip-server-ip- chef-repo]# /opt/chef/embedded/bin/gem install knife-ec2
Building native extensions.  This could take a while...
Building nokogiri using packaged libraries.
ERROR:  Error installing knife-ec2:
        ERROR: Failed to build gem native extension.

        /opt/chef/embedded/bin/ruby extconf.rb
Building nokogiri using packaged libraries.
checking for iconv.h... *** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of
necessary libraries and/or headers.  Check the mkmf.log file for more
details.  You may need configuration options.

Provided configuration options:
        --with-opt-dir
        --with-opt-include
        --without-opt-include=${opt-dir}/include
        --with-opt-lib
        --without-opt-lib=${opt-dir}/lib
        --with-make-prog
        --without-make-prog
        --srcdir=.
        --curdir
        --ruby=/opt/chef/embedded/bin/ruby
        --help
        --clean
        --use-system-libraries
        --enable-static
        --disable-static
        --with-zlib-dir
        --without-zlib-dir
        --with-zlib-include
        --without-zlib-include=${zlib-dir}/include
        --with-zlib-lib
        --without-zlib-lib=${zlib-dir}/lib
        --enable-cross-build
        --disable-cross-build
/opt/chef/embedded/lib/ruby/1.9.1/mkmf.rb:381:in `try_do': The compiler failed to generate an executable file. (RuntimeError)
You have to install development tools first.
        from /opt/chef/embedded/lib/ruby/1.9.1/mkmf.rb:506:in `try_cpp'
        from /opt/chef/embedded/lib/ruby/1.9.1/mkmf.rb:931:in `block in have_header'
        from /opt/chef/embedded/lib/ruby/1.9.1/mkmf.rb:790:in `block in checking_for'
        from /opt/chef/embedded/lib/ruby/1.9.1/mkmf.rb:284:in `block (2 levels) in postpone'
        from /opt/chef/embedded/lib/ruby/1.9.1/mkmf.rb:254:in `open'
        from /opt/chef/embedded/lib/ruby/1.9.1/mkmf.rb:284:in `block in postpone'
        from /opt/chef/embedded/lib/ruby/1.9.1/mkmf.rb:254:in `open'
        from /opt/chef/embedded/lib/ruby/1.9.1/mkmf.rb:280:in `postpone'
        from /opt/chef/embedded/lib/ruby/1.9.1/mkmf.rb:789:in `checking_for'
        from /opt/chef/embedded/lib/ruby/1.9.1/mkmf.rb:930:in `have_header'
        from extconf.rb:103:in `have_iconv?'
        from extconf.rb:148:in `block (2 levels) in iconv_prefix'
        from extconf.rb:90:in `preserving_globals'
        from extconf.rb:143:in `block in iconv_prefix'
        from extconf.rb:116:in `block in each_iconv_idir'
        from extconf.rb:113:in `each'
        from extconf.rb:113:in `each_iconv_idir'
        from extconf.rb:137:in `iconv_prefix'
        from extconf.rb:424:in `block in <main>'
        from extconf.rb:161:in `block in process_recipe'
        from extconf.rb:154:in `tap'
        from extconf.rb:154:in `process_recipe'
        from extconf.rb:419:in `<main>'


Gem files will remain installed in /opt/chef/embedded/lib/ruby/gems/1.9.1/gems/nokogiri-1.6.2.1 for inspection.
Results logged to /opt/chef/embedded/lib/ruby/gems/1.9.1/gems/nokogiri-1.6.2.1/ext/nokogiri/gem_make.out
[root@ip-服务器ip-chef repo]35;/opt/chef/embedded/bin/gem安装刀-ec2
构建本机扩展。这可能需要一段时间。。。
使用打包库构建nokogiri。
错误:安装刀-ec2时出错:
错误:无法生成gem本机扩展。
/opt/chef/embedded/bin/ruby extconf.rb
使用打包库构建nokogiri。
正在检查iconv.h...**extconf.rb失败***
由于某些原因无法创建Makefile,可能是缺少
必要的库和/或标题。查看mkmf.log文件了解更多信息
细节。您可能需要配置选项。
提供的配置选项:
--使用opt dir
--选择包含
--不带opt include=${opt dir}/include
--使用opt lib
--不带opt lib=${opt dir}/lib
--用make prog
--没有make prog
--srcdir=。
--库尔迪尔
--ruby=/opt/chef/embedded/bin/ruby
--帮助
--干净的
--使用系统库
--启用静态
--禁用静态
--使用zlib dir
--没有zlib dir
--与zlib一起包括
--没有zlib include=${zlib dir}/include
--使用zlib库
--没有zlib lib=${zlib dir}/lib
--启用交叉构建
--禁用交叉构建
/opt/chef/embedded/lib/ruby/1.9.1/mkmf.rb:381:在“try_do”中:编译器未能生成可执行文件。(运行时错误)
您必须首先安装开发工具。
from/opt/chef/embedded/lib/ruby/1.9.1/mkmf.rb:506:in'try_cpp'
from/opt/chef/embedded/lib/ruby/1.9.1/mkmf.rb:931:in'block in have_header'
from/opt/chef/embedded/lib/ruby/1.9.1/mkmf.rb:790:in'block in checking_'
from/opt/chef/embedded/lib/ruby/1.9.1/mkmf.rb:284:in'block(2层)in'
from/opt/chef/embedded/lib/ruby/1.9.1/mkmf.rb:254:in'open'
from/opt/chef/embedded/lib/ruby/1.9.1/mkmf.rb:284:in'block in delay'
from/opt/chef/embedded/lib/ruby/1.9.1/mkmf.rb:254:in'open'
from/opt/chef/embedded/lib/ruby/1.9.1/mkmf.rb:280:in“推迟”
from/opt/chef/embedded/lib/ruby/1.9.1/mkmf.rb:789:in'checking_'
from/opt/chef/embedded/lib/ruby/1.9.1/mkmf.rb:930:in'have_header'
来自extconf.rb:103:in‘have_iconv?’
来自extconf.rb:148:in`iconv_前缀中的块(2层)'
摘自extconf.rb:90:in`preserving_globals'
来自extconf.rb:143:in`block in iconv_prefix'
来自extconf.rb:116:in`block in each_iconv_idir'
摘自extconf.rb:113:in'each'
摘自extconf.rb:113:in'each_iconv_idir'
来自extconf.rb:137:in'iconv_prefix'
来自extconf.rb:424:in'block in'
来自extconf.rb:161:in“进程中的块”
摘自extconf.rb:154:in'tap'
摘自extconf.rb:154:in'process_recipe'
来自extconf.rb:419:in`'
Gem文件将继续安装在/opt/chef/embedded/lib/ruby/gems/1.9.1/gems/nokogiri-1.6.2.1中以供检查。
结果记录到/opt/chef/embedded/lib/ruby/gems/1.9.1/gems/nokogiri-1.6.2.1/ext/nokogiri/gem_make.out
如何解决此错误

任何潜在客户都将受到高度赞赏


谢谢

刀-ec2宝石依赖于一种名为nokogiri的宝石。nokogiri gem是一个二进制文件,需要在安装时进行编译。如果向下滚动错误消息,您将看到以下行:

/opt/chef/embedded/lib/ruby/1.9.1/mkmf.rb:381:in `try_do': The compiler failed to generate an executable file. (RuntimeError)
You have to install development tools first.
它只是告诉你在你的工作站上安装gcc和make。在centos中,您可以通过运行:

$ sudo yum groupinstall development-tools
这将为您提供开始编译gem二进制文件所需的一切

如果你刚刚开始与厨师,我实际上会推荐厨师开发工具包。它为您提供了入门所需的所有工具,以及生成烹饪书的测试工具和助手命令


祝你好运

刀-ec2宝石依赖于一种名为nokogiri的宝石。nokogiri gem是一个二进制文件,需要在安装时进行编译。如果向下滚动错误消息,您将看到以下行:

/opt/chef/embedded/lib/ruby/1.9.1/mkmf.rb:381:in `try_do': The compiler failed to generate an executable file. (RuntimeError)
You have to install development tools first.
它只是告诉你在你的工作站上安装gcc和make。在centos中,您可以通过运行:

$ sudo yum groupinstall development-tools
这将为您提供开始编译gem二进制文件所需的一切

如果你刚刚开始与厨师,我实际上会推荐厨师开发工具包。它为您提供了入门所需的所有工具,以及生成烹饪书的测试工具和助手命令


祝你好运

尝试安装以下软件包。我在安装时遇到了类似的错误。我的问题解决了。这可能对你有帮助

sudo apt-get install build-essential  
sudo apt-get install g++ build-essential  
sudo apt-get install rubygems  ruby1.9.1
然后安装刀ec-2插头

$ /opt/chef/embedded/bin/gem install knife-ec2

请尝试安装以下软件包。我在安装时遇到了类似的错误。我的问题解决了。这可能对你有帮助

sudo apt-get install build-essential  
sudo apt-get install g++ build-essential  
sudo apt-get install rubygems  ruby1.9.1
然后安装刀ec-2插头

$ /opt/chef/embedded/bin/gem install knife-ec2

曼尼的回答是正确的,但我想说的是,曼尼的回答是正确的,但我想说的是,我已经安装了厨师、工作站和厨师刀。我只想安装插件刀子-EC2此问题已解决。现在我面临另一个问题:当我运行刀子客户端列表时警告:未找到刀子配置文件错误:您的私钥无法从/etc/chef/client.pem加载。请检查您的配置文件,并确保您的私钥可读,无论我如何在中定义路径bash_配置文件中也包含knife.rb文件,文件位于/root/chef repo/.chef中。请帮助meThis路径
/root/chef repo/.chef
仅在您以root身份工作并且在该目录中运行命令时才有效。如果你想从其他目录运行刀子命令,你必须在~/.chef中有你的刀子.rb。我还在