2011年7月22日金曜日

centosのchefワークステーションのAMI更新

以前とったcentosのchefワークステーションのamiを更新したい。
・knife ec2コマンドを使えるようにして、ほかのchefクライアントを起動できるようにする。




以前のamazon linuxでやったのと同じように、knife ec2の前提条件パッケージをインストールします。

[root@ip-10-146-157-117 chef-repo]# sudo gem install net-ssh net-ssh-multi fog highline

Successfully installed net-ssh-2.1.4
Fetching: net-ssh-multi-1.1.gem (100%)
Successfully installed net-ssh-multi-1.1
Fetching: builder-3.0.0.gem (100%)
Fetching: excon-0.6.5.gem (100%)
Fetching: formatador-0.2.0.gem (100%)
Fetching: net-scp-1.0.4.gem (100%)
Fetching: nokogiri-1.5.0.gem (100%)
Building native extensions.  This could take a while...
ERROR:  Error installing fog:
        ERROR: Failed to build gem native extension.

        /usr/bin/ruby extconf.rb
checking for libxml/parser.h... no
-----
libxml2 is missing.  please visit http://nokogiri.org/tutorials/installing_nokogiri.html for help with installing dependencies.
-----
*** 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
        --without-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=/usr/bin/ruby
        --with-zlib-dir
        --without-zlib-dir
        --with-zlib-include
        --without-zlib-include=${zlib-dir}/include
        --with-zlib-lib
        --without-zlib-lib=${zlib-dir}/lib
        --with-iconv-dir
        --without-iconv-dir
        --with-iconv-include
        --without-iconv-include=${iconv-dir}/include
        --with-iconv-lib
        --without-iconv-lib=${iconv-dir}/lib
        --with-xml2-dir
        --without-xml2-dir
        --with-xml2-include
        --without-xml2-include=${xml2-dir}/include
        --with-xml2-lib
        --without-xml2-lib=${xml2-dir}/lib
        --with-xslt-dir
        --without-xslt-dir
        --with-xslt-include
        --without-xslt-include=${xslt-dir}/include
        --with-xslt-lib
        --without-xslt-lib=${xslt-dir}/lib


Gem files will remain installed in /usr/lib/ruby/gems/1.8/gems/nokogiri-1.5.0 for inspection.
Results logged to /usr/lib/ruby/gems/1.8/gems/nokogiri-1.5.0/ext/nokogiri/gem_make.out
Successfully installed highline-1.6.2
3 gems installed
Installing ri documentation for net-ssh-2.1.4...
Installing ri documentation for net-ssh-multi-1.1...
Installing ri documentation for highline-1.6.2...
Installing RDoc documentation for net-ssh-2.1.4...
Installing RDoc documentation for net-ssh-multi-1.1...
Installing RDoc documentation for highline-1.6.2...
[root@ip-10-146-157-117 chef-repo]#
[root@ip-10-146-157-117 chef-repo]# sudo yum install libxml-devel libxslt-devel
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
 * addons: mirror.netrino.co.uk
 * base: mirror.netrino.co.uk
 * epel: www.mirrorservice.org
 * extras: mirrors.supportex.net
 * updates: mirrors.supportex.net
Setting up Install Process
No package libxml-devel available.
Resolving Dependencies
--> Running transaction check
---> Package libxslt-devel.i386 0:1.1.17-2.el5_2.2 set to be updated
--> Processing Dependency: libxslt = 1.1.17 for package: libxslt-devel
--> Processing Dependency: libxml2-devel >= 2.5.6 for package: libxslt-devel
--> Processing Dependency: libgcrypt-devel for package: libxslt-devel
--> Processing Dependency: libexslt.so.0 for package: libxslt-devel
--> Processing Dependency: libxslt.so.1 for package: libxslt-devel
--> Running transaction check
---> Package libgcrypt-devel.i386 0:1.4.4-5.el5 set to be updated
--> Processing Dependency: libgpg-error-devel for package: libgcrypt-devel
---> Package libxml2-devel.i386 0:2.6.26-2.1.2.8.el5_5.1 set to be updated
---> Package libxslt.i386 0:1.1.17-2.el5_2.2 set to be updated
--> Running transaction check
---> Package libgpg-error-devel.i386 0:1.4-2 set to be updated
--> Finished Dependency Resolution

Dependencies Resolved

================================================================================
 Package                 Arch      Version                      Repository
                                                                           Size
================================================================================
Installing:
 libxslt-devel           i386      1.1.17-2.el5_2.2             base      295 k
Installing for dependencies:
 libgcrypt-devel         i386      1.4.4-5.el5                  base      396 k
 libgpg-error-devel      i386      1.4-2                        base       17 k
 libxml2-devel           i386      2.6.26-2.1.2.8.el5_5.1       base      2.1 M
 libxslt                 i386      1.1.17-2.el5_2.2             base      485 k

Transaction Summary
================================================================================
Install       5 Package(s)
Upgrade       0 Package(s)

Total download size: 3.3 M
Is this ok [y/N]: y
Downloading Packages:
(1/5): libgpg-error-devel-1.4-2.i386.rpm                 |  17 kB     00:00
(2/5): libxslt-devel-1.1.17-2.el5_2.2.i386.rpm           | 295 kB     00:01
(3/5): libgcrypt-devel-1.4.4-5.el5.i386.rpm              | 396 kB     00:02
(4/5): libxslt-1.1.17-2.el5_2.2.i386.rpm                 | 485 kB     00:03
(5/5): libxml2-devel-2.6.26-2.1.2.8.el5_5.1.i386.rpm     | 2.1 MB     00:06
--------------------------------------------------------------------------------
Total                                           187 kB/s | 3.3 MB     00:17
Running rpm_check_debug
Running Transaction Test
Finished Transaction Test
Transaction Test Succeeded
Running Transaction
  Installing     : libxslt                                                  1/5
  Installing     : libxml2-devel                                            2/5
  Installing     : libgpg-error-devel                                       3/5
  Installing     : libgcrypt-devel                                          4/5
  Installing     : libxslt-devel                                            5/5

Installed:
  libxslt-devel.i386 0:1.1.17-2.el5_2.2

Dependency Installed:
  libgcrypt-devel.i386 0:1.4.4-5.el5           libgpg-error-devel.i386 0:1.4-2
  libxml2-devel.i386 0:2.6.26-2.1.2.8.el5_5.1  libxslt.i386 0:1.1.17-2.el5_2.2

Complete!
[root@ip-10-146-157-117 chef-repo]#

[root@ip-10-146-157-117 chef-repo]# sudo gem install fog
Building native extensions.  This could take a while...
Fetching: ruby-hmac-0.4.0.gem (100%)
Fetching: fog-0.9.0.gem (100%)
Successfully installed nokogiri-1.5.0
Successfully installed ruby-hmac-0.4.0
Successfully installed fog-0.9.0
3 gems installed
Installing ri documentation for nokogiri-1.5.0...

No definition for get_options

No definition for set_options

No definition for parse_memory

No definition for parse_file

No definition for parse_with
Installing ri documentation for ruby-hmac-0.4.0...
Installing ri documentation for fog-0.9.0...
sInstalling RDoc documentation for nokogiri-1.5.0...

No definition for get_options

No definition for set_options

No definition for parse_memory

No definition for parse_file

No definition for parse_with
Installing RDoc documentation for ruby-hmac-0.4.0...
Installing RDoc documentation for fog-0.9.0...
[root@ip-10-146-157-117 chef-repo]#


次にknife.rbに以下を追加した。


knife[:aws_access_key_id]     = "Your AWS Access Key"
knife[:aws_secret_access_key] = "Your AWS Secret Access Key"



このあと、knife ec2 server create

こまんどでcentosのインスタンスの起動ができた。

これでバックアップを取る。AMI NAMEはami-20d16421_chef_workstation_centosです。

0 件のコメント:

コメントを投稿