2011年8月17日水曜日

oracle linux x86でchef-solo動かすまでのログ

** install prereq for guest additions **
yum install gcc
yum install kernel-dev
yum install kernel-uek-devel


** checkinstall のinstall***

$cd /usr/local/src/
$wget http://asic-linux.com.mx/~izto/checkinstall/files/source/checkinstall-1.6.2.tar.gz
$tar zxvf checkinstall-1.6.2.tar.gz
$cd checkinstall-1.6.2.tar.gz
$make install

  $/usr/local/sbin/checkinstall
  $rpm -i /usr/src/redhat/RPMS/x86_64/checkinstall-1.6.2-1.x86_64.rpm

  確認
  yum list checkinstall


**** ruby install**

cd /usr/local/src
wget ftp://ftp.ruby-lang.org/pub/ruby/1.8/ruby-1.8.7-p352.tar.gz
wget http://ftp.ruby-lang.org/pub/ruby/1.8/ruby-1.8.7.tar.gz
wget http://ftp.ruby-lang.org/pub/ruby/1.8/ruby-1.8.7-p352.tar.gz
tar zxvf ruby-1.8.7-p352.tar.gz
cd ruby-1.8.7-p352
./configure --prefix=/usr
make
checkinstall --fstrans=no
--> rpm-buildが必要と言われた

yum install rpm-build  (got from ol5_latest)
ls -ltr /usr/bin  (ruby, testrb, ri, rdoc, irb, erbが入っている)

rpm -i /usr/src/redhat/RPMS/x86_64/ruby-1.8.7-p352-1.x86_64.rpm


*** gem install ***

cd /usr/local/src
wget http://production.cf.rubygems.org/rubygems/rubygems-1.3.7.tgz
tar zxf rubygems-1.3.7.tgz
cd rubygems-1.3.7
ruby setup.rb --no-format-executable

gem -v ... ok
[root@localhost ruby-1.8.7-p352]# gem install chef
ERROR:  Loading command: install (LoadError)
    no such file to load -- zlib
ERROR:  While executing gem ... (NameError)
    uninitialized constant Gem::Commands::InstallCommand


対処
yum install zlib-devel
cd /usr/local/src/ruby-1.8.7-p352/ext/zlib
[root@localhost zlib]# ruby extconf.rb
checking for deflateReset() in -lz... yes
checking for zlib.h... yes
checking for kind of operating system... Unix
creating Makefile

[root@localhost zlib]# ls
Makefile  doc  extconf.rb  mkmf.log  zlib.c
[root@localhost zlib]# make
gcc -I. -I. -I/usr/lib/ruby/1.8/x86_64-linux -I. -DHAVE_ZLIB_H  -DOS_CODE=OS_UNIX    -fPIC -g -O2   -c zlib.c
gcc -shared -o zlib.so zlib.o -L. -L/usr/lib -Wl,-R/usr/lib -L.  -rdynamic -Wl,-export-dynamic    -lz  -lrt -ldl -lcrypt -lm   -lc
/usr/bin/ld: skipping incompatible /usr/lib/libz.so when searching for -lz
/usr/bin/ld: skipping incompatible /usr/lib/libz.a when searching for -lz
[root@localhost zlib]# ls -ltr
合計 400
-rw-r--r-- 1 10347 10347   1362  5月 29  2008 extconf.rb
-rw-r--r-- 1 10347 10347  88549  5月 23 13:49 zlib.c
drwxr-xr-x 2 10347 10347   4096  7月  2 18:53 doc
-rw-r--r-- 1 root  root    1411  8月 17 18:16 mkmf.log
-rw-r--r-- 1 root  root    3730  8月 17 18:16 Makefile
-rwxr-xr-x 1 root  root  105396  8月 17 18:17 zlib.so
-rw-r--r-- 1 root  root  152208  8月 17 18:17 zlib.o
[root@localhost zlib]# make install
/usr/bin/install -c -m 0755 zlib.so /usr/lib/ruby/site_ruby/1.8/x86_64-linux
[root@localhost zlib]# ls -ltr
合計 400
-rw-r--r-- 1 10347 10347   1362  5月 29  2008 extconf.rb
-rw-r--r-- 1 10347 10347  88549  5月 23 13:49 zlib.c
drwxr-xr-x 2 10347 10347   4096  7月  2 18:53 doc
-rw-r--r-- 1 root  root    1411  8月 17 18:16 mkmf.log
-rw-r--r-- 1 root  root    3730  8月 17 18:16 Makefile
-rwxr-xr-x 1 root  root  105396  8月 17 18:17 zlib.so
-rw-r--r-- 1 root  root  152208  8月 17 18:17 zlib.o



gemする前にproxy 設定
export http_proxy=http://xxx:80

ついに
[root@localhost zlib]# gem install chef
Building native extensions.  This could take a while...
[Version 0.7.3] AMQP connection URI parser now respects port
Building native extensions.  This could take a while...
Successfully installed mixlib-config-1.1.2
Successfully installed mixlib-cli-1.2.0
Successfully installed mixlib-log-1.3.0
Successfully installed mixlib-authentication-1.1.4
Successfully installed yajl-ruby-0.8.3
Successfully installed systemu-2.3.0
Successfully installed ohai-0.6.4
Successfully installed mime-types-1.16
Successfully installed rest-client-1.6.3
Successfully installed bunny-0.7.4
Successfully installed json-1.5.2
Successfully installed polyglot-0.3.2
Successfully installed treetop-1.4.10
Successfully installed net-ssh-2.1.4
Successfully installed net-ssh-gateway-1.1.0
Successfully installed net-ssh-multi-1.1
Successfully installed erubis-2.7.0
Successfully installed moneta-0.6.0
Successfully installed highline-1.6.2
Successfully installed uuidtools-2.1.2
Successfully installed chef-0.10.4
21 gems installed
Installing ri documentation for mixlib-config-1.1.2...
Installing ri documentation for mixlib-cli-1.2.0...
Unrecognized directive 'short' in README.rdoc
Unrecognized directive 'long' in README.rdoc
Unrecognized directive 'description' in README.rdoc
Unrecognized directive 'default' in README.rdoc
Unrecognized directive 'required' in README.rdoc
Unrecognized directive 'on' in README.rdoc
Unrecognized directive 'boolean' in README.rdoc
Unrecognized directive 'show_options' in README.rdoc
Unrecognized directive 'exit' in README.rdoc
Unrecognized directive 'proc' in README.rdoc
Installing ri documentation for mixlib-log-1.3.0...
Installing ri documentation for mixlib-authentication-1.1.4...
Installing ri documentation for yajl-ruby-0.8.3...
Installing ri documentation for systemu-2.3.0...
Installing ri documentation for ohai-0.6.4...
Installing ri documentation for mime-types-1.16...
Installing ri documentation for rest-client-1.6.3...
Installing ri documentation for bunny-0.7.4...
Installing ri documentation for json-1.5.2...
Installing ri documentation for polyglot-0.3.2...
Installing ri documentation for treetop-1.4.10...
Installing ri documentation for net-ssh-2.1.4...
Installing ri documentation for net-ssh-gateway-1.1.0...
Installing ri documentation for net-ssh-multi-1.1...
Installing ri documentation for erubis-2.7.0...
Installing ri documentation for moneta-0.6.0...
Installing ri documentation for highline-1.6.2...
Installing ri documentation for uuidtools-2.1.2...
Installing ri documentation for chef-0.10.4...
Installing RDoc documentation for mixlib-config-1.1.2...
Installing RDoc documentation for mixlib-cli-1.2.0...
Unrecognized directive 'short' in README.rdoc
Unrecognized directive 'long' in README.rdoc
Unrecognized directive 'description' in README.rdoc
Unrecognized directive 'default' in README.rdoc
Unrecognized directive 'required' in README.rdoc
Unrecognized directive 'on' in README.rdoc
Unrecognized directive 'boolean' in README.rdoc
Unrecognized directive 'show_options' in README.rdoc
Unrecognized directive 'exit' in README.rdoc
Unrecognized directive 'proc' in README.rdoc
Installing RDoc documentation for mixlib-log-1.3.0...
Installing RDoc documentation for mixlib-authentication-1.1.4...
Installing RDoc documentation for yajl-ruby-0.8.3...
Installing RDoc documentation for systemu-2.3.0...
Installing RDoc documentation for ohai-0.6.4...
Installing RDoc documentation for mime-types-1.16...
Installing RDoc documentation for rest-client-1.6.3...
Installing RDoc documentation for bunny-0.7.4...
Could not find main page README.rdoc
Could not find main page README.rdoc
Could not find main page README.rdoc
Could not find main page README.rdoc
Installing RDoc documentation for json-1.5.2...
Installing RDoc documentation for polyglot-0.3.2...
Installing RDoc documentation for treetop-1.4.10...
Installing RDoc documentation for net-ssh-2.1.4...
Installing RDoc documentation for net-ssh-gateway-1.1.0...
Installing RDoc documentation for net-ssh-multi-1.1...
Installing RDoc documentation for erubis-2.7.0...
Installing RDoc documentation for moneta-0.6.0...
Installing RDoc documentation for highline-1.6.2...
Installing RDoc documentation for uuidtools-2.1.2...
Installing RDoc documentation for chef-0.10.4...
[root@localhost zlib]#




[root@localhost zlib]# knife
/usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `gem_original_require': no such file to load -- openssl.so (LoadError)
        from /usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `require'
        from /usr/lib/ruby/1.8/openssl.rb:17
        from /usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `gem_original_require'
        from /usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `require'
        from /usr/lib/ruby/1.8/net/https.rb:102
        from /usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `gem_original_require'
        from /usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `require'
        from /usr/lib/ruby/gems/1.8/gems/chef-0.10.4/lib/chef/rest.rb:23
        from /usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `gem_original_require'
        from /usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `require'
        from /usr/lib/ruby/gems/1.8/gems/chef-0.10.4/lib/chef/knife.rb:26
        from /usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `gem_original_require'
        from /usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `require'
        from /usr/lib/ruby/gems/1.8/gems/chef-0.10.4/lib/chef/application/knife.rb:18
        from /usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `gem_original_require'
        from /usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `require'
        from /usr/lib/ruby/gems/1.8/gems/chef-0.10.4/bin/knife:23
        from /usr/bin/knife:19:in `load'
        from /usr/bin/knife:19



[root@localhost zlib]# chef-solo
/usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `gem_original_require': no such file to load -- openssl.so (LoadError)
        from /usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `require'
        from /usr/lib/ruby/1.8/openssl.rb:17
        from /usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `gem_original_require'
        from /usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `require'
        from /usr/lib/ruby/1.8/net/https.rb:102
        from /usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `gem_original_require'
        from /usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `require'
        from /usr/lib/ruby/gems/1.8/gems/chef-0.10.4/bin/../lib/chef/rest.rb:23
        from /usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `gem_original_require'
        from /usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `require'
        from /usr/lib/ruby/gems/1.8/gems/chef-0.10.4/bin/../lib/chef/search/query.rb:21
        from /usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `gem_original_require'
        from /usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `require'
        from /usr/lib/ruby/gems/1.8/gems/chef-0.10.4/bin/../lib/chef/mixin/language.rb:19
        from /usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `gem_original_require'
        from /usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `require'
        from /usr/lib/ruby/gems/1.8/gems/chef-0.10.4/bin/../lib/chef/resource.rb:22
        from /usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `gem_original_require'
        from /usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `require'
        from /usr/lib/ruby/gems/1.8/gems/chef-0.10.4/bin/../lib/chef/resource/file.rb:19
        from /usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `gem_original_require'
        from /usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `require'
        from /usr/lib/ruby/gems/1.8/gems/chef-0.10.4/bin/../lib/chef/provider/file.rb:21
        from /usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `gem_original_require'
        from /usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `require'
        from /usr/lib/ruby/gems/1.8/gems/chef-0.10.4/bin/../lib/chef/provider/cookbook_file.rb:20
        from /usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `gem_original_require'
        from /usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `require'
        from /usr/lib/ruby/gems/1.8/gems/chef-0.10.4/bin/../lib/chef/providers.rb:20
        from /usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `gem_original_require'
        from /usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `require'
        from /usr/lib/ruby/gems/1.8/gems/chef-0.10.4/bin/../lib/chef.rb:25
        from /usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `gem_original_require'
        from /usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `require'
        from /usr/lib/ruby/gems/1.8/gems/chef-0.10.4/bin/../lib/chef/application/solo.rb:18
        from /usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `gem_original_require'
        from /usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `require'
        from /usr/lib/ruby/gems/1.8/gems/chef-0.10.4/bin/chef-solo:23
        from /usr/bin/chef-solo:19:in `load'
        from /usr/bin/chef-solo:19
[root@localhost zlib]#


対処
cd /usr/local/src/ruby-1.8.7-p352
./configure --prefix=/usr --disable-option-checking --with-openssl-dir=/usr/lib/openssl
make
checkinstall --fstrans=no
rpm -i /usr/src/redhat/RPMS/x86_64/ruby-1.8.7-p352-1.x86_64.rpm


このあとknifeしてもだめだたt。。。




yum install openssl-devel




[root@localhost rubygems-1.3.7]# cd ../ruby-1.8.7-p352
[root@localhost ruby-1.8.7-p352]# ls
"$as_dir"      class.c        dmydln.c      inits.c           missing.h    re.c         st.h
COPYING        class.o        dmyext.c      inits.o           mkconfig.rb  re.h         st.o
COPYING.ja     common.mk      dmyext.o      install-sh        node.h       re.o         string.c
ChangeLog      compar.c       doc           instruby.rb       numeric.c    regex.c      string.o
GPL            compar.o       enum.c        intern.h          numeric.o    regex.h      struct.c
LEGAL          config.guess   enum.o        io.c              object.c     regex.o      struct.o
LGPL           config.h       enumerator.c  io.o              object.o     ruby         test
Makefile       config.log     enumerator.o  keywords          pack.c       ruby.1       time.c
Makefile.in    config.status  env.h         lex.c             pack.o       ruby.c       time.o
NEWS           config.sub     error.c       lib               parse.c      ruby.h       util.c
README         configure      error.o       libruby-static.a  parse.o      ruby.o       util.h
README.EXT     configure.in   eval.c        main.c            parse.y      rubyio.h     util.o
README.EXT.ja  cygwin         eval.o        main.o            prec.c       rubysig.h    variable.c
README.ja      defines.h      ext           marshal.c         prec.o       rubytest.rb  variable.o
ToDo           dir.c          file.c        marshal.o         process.c    runruby.rb   version.c
array.c        dir.o          file.o        math.c            process.o    sample       version.h
array.o        distruby.rb    gc.c          math.o            random.c     signal.c     version.o
bcc32          djgpp          gc.o          mdoc2man.rb       random.o     signal.o     vms
bignum.c       dln.c          hash.c        miniruby          range.c      sprintf.c    win32
bignum.o       dln.h          hash.o        misc              range.o      sprintf.o    wince
bin            dln.o          ia64.s        missing           rbconfig.rb  st.c         x68
[root@localhost ruby-1.8.7-p352]# cd ext/
[root@localhost ext]# ls
Setup         Setup.nt    curses  etc       iconv    pty         sdbm      syck    win32ole
Setup.atheos  Setup.x68   dbm     extmk.rb  io       purelib.rb  socket    syslog  zlib
Setup.dj      Win32API    digest  fcntl     nkf      racc        stringio  thread
Setup.emx     bigdecimal  dl      gdbm      openssl  readline    strscan   tk
[root@localhost ext]# cd openssl/
[root@localhost openssl]# ls
Makefile           ossl_bio.c     ossl_engine.c   ossl_pkcs5.c     ossl_rand.c         ossl_x509crl.c
extconf.rb         ossl_bio.h     ossl_engine.h   ossl_pkcs5.h     ossl_rand.h         ossl_x509ext.c
lib                ossl_bn.c      ossl_hmac.c     ossl_pkcs7.c     ossl_ssl.c          ossl_x509name.c
mkmf.log           ossl_bn.h      ossl_hmac.h     ossl_pkcs7.h     ossl_ssl.h          ossl_x509req.c
openssl_missing.c  ossl_cipher.c  ossl_ns_spki.c  ossl_pkey.c      ossl_ssl_session.c  ossl_x509revoked.c
openssl_missing.h  ossl_cipher.h  ossl_ns_spki.h  ossl_pkey.h      ossl_version.h      ossl_x509store.c
ossl.c             ossl_config.c  ossl_ocsp.c     ossl_pkey_dh.c   ossl_x509.c         ruby_missing.h
ossl.h             ossl_config.h  ossl_ocsp.h     ossl_pkey_dsa.c  ossl_x509.h
ossl_asn1.c        ossl_digest.c  ossl_pkcs12.c   ossl_pkey_ec.c   ossl_x509attr.c
ossl_asn1.h        ossl_digest.h  ossl_pkcs12.h   ossl_pkey_rsa.c  ossl_x509cert.c
[root@localhost openssl]# ls /usr/local/ssl
ls: /usr/local/ssl: そのようなファイルやディレクトリはありません
[root@localhost openssl]# ls /usr/local/ssl
ls: /usr/local/ssl: そのようなファイルやディレクトリはありません
[root@localhost openssl]# ls /usr/local
bin  etc  games  include  lib  lib64  libexec  sbin  share  src
[root@localhost openssl]# ruby extconf.rb --with-openssl-dir=/usr/local/openssl
=== OpenSSL for Ruby configurator ===
=== Checking for system dependent stuff... ===
checking for t_open() in -lnsl... no
checking for socket() in -lsocket... no
checking for assert.h... yes
=== Checking for required stuff... ===
checking for openssl/ssl.h... yes
checking for OpenSSL_add_all_digests() in -lcrypto... yes
checking for SSL_library_init() in -lssl... yes
checking for openssl/conf_api.h... yes
checking for rb_str_set_len() in ruby.h... yes
checking for rb_block_call() in ruby.h... yes
=== Checking for OpenSSL features... ===
checking for ERR_peek_last_error()... yes
checking for BN_mod_add()... yes
checking for BN_mod_sqr()... yes
checking for BN_mod_sub()... yes
checking for BN_pseudo_rand_range()... yes
checking for BN_rand_range()... yes
checking for CONF_get1_default_config_file()... yes
checking for EVP_CIPHER_CTX_copy()... no
checking for EVP_CIPHER_CTX_set_padding()... yes
checking for EVP_CipherFinal_ex()... yes
checking for EVP_CipherInit_ex()... yes
checking for EVP_DigestFinal_ex()... yes
checking for EVP_DigestInit_ex()... yes
checking for EVP_MD_CTX_cleanup()... yes
checking for EVP_MD_CTX_create()... yes
checking for EVP_MD_CTX_destroy()... yes
checking for EVP_MD_CTX_init()... yes
checking for HMAC_CTX_cleanup()... yes
checking for HMAC_CTX_copy()... no
checking for HMAC_CTX_init()... yes
checking for PEM_def_callback()... yes
checking for PKCS5_PBKDF2_HMAC()... no
checking for PKCS5_PBKDF2_HMAC_SHA1()... yes
checking for X509V3_set_nconf()... yes
checking for X509V3_EXT_nconf_nid()... yes
checking for X509_CRL_add0_revoked()... yes
checking for X509_CRL_set_issuer_name()... yes
checking for X509_CRL_set_version()... yes
checking for X509_CRL_sort()... yes
checking for X509_NAME_hash_old()... no
checking for X509_STORE_get_ex_data()... no
checking for X509_STORE_set_ex_data()... no
checking for OBJ_NAME_do_all_sorted()... yes
checking for SSL_SESSION_get_id()... yes
checking for OPENSSL_cleanse()... yes
checking for SSLv2_method()... yes
checking for SSLv2_server_method()... yes
checking for SSLv2_client_method()... yes
checking for SSL_set_tlsext_host_name() in openssl/ssl.h... no
checking for SSL_set_tlsext_host_name in openssl/ssl.h... no
checking for openssl/engine.h... yes
checking for ENGINE_add()... yes
checking for ENGINE_load_builtin_engines()... yes
checking for ENGINE_load_openbsd_dev_crypto()... no
checking for ENGINE_get_digest()... yes
checking for ENGINE_get_cipher()... yes
checking for ENGINE_cleanup()... yes
checking for ENGINE_load_4758cca()... no
checking for ENGINE_load_aep()... no
checking for ENGINE_load_atalla()... no
checking for ENGINE_load_chil()... no
checking for ENGINE_load_cswift()... no
checking for ENGINE_load_nuron()... no
checking for ENGINE_load_sureware()... no
checking for ENGINE_load_ubsec()... no
checking for openssl/ocsp.h... yes
checking for EVP_CIPHER_CTX.flags in openssl/evp.h... yes
checking for EVP_CIPHER_CTX.engine in openssl/evp.h... yes
checking for X509_ATTRIBUTE.single in openssl/x509.h... yes
=== Checking done. ===
creating extconf.h
creating Makefile
Done.
[root@localhost openssl]# make
gcc -I. -I. -I/usr/lib/ruby/1.8/x86_64-linux -I. -DRUBY_EXTCONF_H=\"extconf.h\" -I/usr/local/openssl/include    -fPIC -g -O2   -c ossl_x509crl.c
gcc -I. -I. -I/usr/lib/ruby/1.8/x86_64-linux -I. -DRUBY_EXTCONF_H=\"extconf.h\" -I/usr/local/openssl/include    -fPIC -g -O2   -c ossl_ssl_session.c
gcc -I. -I. -I/usr/lib/ruby/1.8/x86_64-linux -I. -DRUBY_EXTCONF_H=\"extconf.h\" -I/usr/local/openssl/include    -fPIC -g -O2   -c ossl_x509cert.c
ossl_x509cert.c: In function ‘ossl_x509_inspect’:
ossl_x509cert.c:693: 警告: initialization discards qualifiers from pointer target type
gcc -I. -I. -I/usr/lib/ruby/1.8/x86_64-linux -I. -DRUBY_EXTCONF_H=\"extconf.h\" -I/usr/local/openssl/include    -fPIC -g -O2   -c ossl_bio.c
gcc -I. -I. -I/usr/lib/ruby/1.8/x86_64-linux -I. -DRUBY_EXTCONF_H=\"extconf.h\" -I/usr/local/openssl/include    -fPIC -g -O2   -c ossl_pkey_ec.c
gcc -I. -I. -I/usr/lib/ruby/1.8/x86_64-linux -I. -DRUBY_EXTCONF_H=\"extconf.h\" -I/usr/local/openssl/include    -fPIC -g -O2   -c ossl_pkey_dh.c
gcc -I. -I. -I/usr/lib/ruby/1.8/x86_64-linux -I. -DRUBY_EXTCONF_H=\"extconf.h\" -I/usr/local/openssl/include    -fPIC -g -O2   -c ossl_bn.c
gcc -I. -I. -I/usr/lib/ruby/1.8/x86_64-linux -I. -DRUBY_EXTCONF_H=\"extconf.h\" -I/usr/local/openssl/include    -fPIC -g -O2   -c ossl_x509ext.c
ossl_x509ext.c: In function ‘ossl_x509ext_initialize’:
ossl_x509ext.c:286: 警告: passing argument 2 of ‘d2i_X509_EXTENSION’ from incompatible pointer type
gcc -I. -I. -I/usr/lib/ruby/1.8/x86_64-linux -I. -DRUBY_EXTCONF_H=\"extconf.h\" -I/usr/local/openssl/include    -fPIC -g -O2   -c ossl_hmac.c
gcc -I. -I. -I/usr/lib/ruby/1.8/x86_64-linux -I. -DRUBY_EXTCONF_H=\"extconf.h\" -I/usr/local/openssl/include    -fPIC -g -O2   -c ossl_rand.c
gcc -I. -I. -I/usr/lib/ruby/1.8/x86_64-linux -I. -DRUBY_EXTCONF_H=\"extconf.h\" -I/usr/local/openssl/include    -fPIC -g -O2   -c ossl_pkey_rsa.c
gcc -I. -I. -I/usr/lib/ruby/1.8/x86_64-linux -I. -DRUBY_EXTCONF_H=\"extconf.h\" -I/usr/local/openssl/include    -fPIC -g -O2   -c ossl.c
gcc -I. -I. -I/usr/lib/ruby/1.8/x86_64-linux -I. -DRUBY_EXTCONF_H=\"extconf.h\" -I/usr/local/openssl/include    -fPIC -g -O2   -c openssl_missing.c
gcc -I. -I. -I/usr/lib/ruby/1.8/x86_64-linux -I. -DRUBY_EXTCONF_H=\"extconf.h\" -I/usr/local/openssl/include    -fPIC -g -O2   -c ossl_ssl.c
gcc -I. -I. -I/usr/lib/ruby/1.8/x86_64-linux -I. -DRUBY_EXTCONF_H=\"extconf.h\" -I/usr/local/openssl/include    -fPIC -g -O2   -c ossl_config.c
gcc -I. -I. -I/usr/lib/ruby/1.8/x86_64-linux -I. -DRUBY_EXTCONF_H=\"extconf.h\" -I/usr/local/openssl/include    -fPIC -g -O2   -c ossl_pkcs5.c
gcc -I. -I. -I/usr/lib/ruby/1.8/x86_64-linux -I. -DRUBY_EXTCONF_H=\"extconf.h\" -I/usr/local/openssl/include    -fPIC -g -O2   -c ossl_pkcs12.c
gcc -I. -I. -I/usr/lib/ruby/1.8/x86_64-linux -I. -DRUBY_EXTCONF_H=\"extconf.h\" -I/usr/local/openssl/include    -fPIC -g -O2   -c ossl_x509name.c
ossl_x509name.c: In function ‘ossl_x509name_initialize’:
ossl_x509name.c:143: 警告: passing argument 2 of ‘d2i_X509_NAME’ from incompatible pointer type
gcc -I. -I. -I/usr/lib/ruby/1.8/x86_64-linux -I. -DRUBY_EXTCONF_H=\"extconf.h\" -I/usr/local/openssl/include    -fPIC -g -O2   -c ossl_engine.c
ossl_engine.c: In function ‘ossl_engine_inspect’:
ossl_engine.c:347: 警告: initialization discards qualifiers from pointer target type
gcc -I. -I. -I/usr/lib/ruby/1.8/x86_64-linux -I. -DRUBY_EXTCONF_H=\"extconf.h\" -I/usr/local/openssl/include    -fPIC -g -O2   -c ossl_ns_spki.c
ossl_ns_spki.c: In function ‘ossl_spki_initialize’:
ossl_ns_spki.c:67: 警告: passing argument 2 of ‘d2i_NETSCAPE_SPKI’ from incompatible pointer type
gcc -I. -I. -I/usr/lib/ruby/1.8/x86_64-linux -I. -DRUBY_EXTCONF_H=\"extconf.h\" -I/usr/local/openssl/include    -fPIC -g -O2   -c ossl_x509attr.c
ossl_x509attr.c: In function ‘ossl_x509attr_initialize’:
ossl_x509attr.c:104: 警告: passing argument 2 of ‘d2i_X509_ATTRIBUTE’ from incompatible pointer type
gcc -I. -I. -I/usr/lib/ruby/1.8/x86_64-linux -I. -DRUBY_EXTCONF_H=\"extconf.h\" -I/usr/local/openssl/include    -fPIC -g -O2   -c ossl_pkey_dsa.c
ossl_pkey_dsa.c: In function ‘ossl_dsa_initialize’:
ossl_pkey_dsa.c:165: 警告: passing argument 1 of ‘PEM_ASN1_read_bio’ from incompatible pointer type
ossl_pkey_dsa.c:165: 警告: passing argument 4 of ‘PEM_ASN1_read_bio’ from incompatible pointer type
ossl_pkey_dsa.c: In function ‘ossl_dsa_to_public_key’:
ossl_pkey_dsa.c:370: 警告: passing argument 2 of ‘ASN1_dup’ from incompatible pointer type
gcc -I. -I. -I/usr/lib/ruby/1.8/x86_64-linux -I. -DRUBY_EXTCONF_H=\"extconf.h\" -I/usr/local/openssl/include    -fPIC -g -O2   -c ossl_asn1.c
ossl_asn1.c: In function ‘decode_bool’:
ossl_asn1.c:317: 警告: passing argument 2 of ‘d2i_ASN1_BOOLEAN’ from incompatible pointer type
ossl_asn1.c: In function ‘decode_int’:
ossl_asn1.c:332: 警告: passing argument 2 of ‘d2i_ASN1_INTEGER’ from incompatible pointer type
ossl_asn1.c: In function ‘decode_enum’:
ossl_asn1.c:372: 警告: passing argument 2 of ‘d2i_ASN1_ENUMERATED’ from incompatible pointer type
ossl_asn1.c: In function ‘decode_null’:
ossl_asn1.c:389: 警告: passing argument 2 of ‘d2i_ASN1_NULL’ from incompatible pointer type
ossl_asn1.c: In function ‘decode_obj’:
ossl_asn1.c:406: 警告: passing argument 2 of ‘d2i_ASN1_OBJECT’ from incompatible pointer type
ossl_asn1.c: In function ‘decode_time’:
ossl_asn1.c:434: 警告: passing argument 2 of ‘d2i_ASN1_TIME’ from incompatible pointer type
ossl_asn1.c: In function ‘ossl_asn1_decode0’:
ossl_asn1.c:726: 警告: passing argument 1 of ‘ASN1_get_object’ from incompatible pointer type
gcc -I. -I. -I/usr/lib/ruby/1.8/x86_64-linux -I. -DRUBY_EXTCONF_H=\"extconf.h\" -I/usr/local/openssl/include    -fPIC -g -O2   -c ossl_pkey.c
gcc -I. -I. -I/usr/lib/ruby/1.8/x86_64-linux -I. -DRUBY_EXTCONF_H=\"extconf.h\" -I/usr/local/openssl/include    -fPIC -g -O2   -c ossl_digest.c
gcc -I. -I. -I/usr/lib/ruby/1.8/x86_64-linux -I. -DRUBY_EXTCONF_H=\"extconf.h\" -I/usr/local/openssl/include    -fPIC -g -O2   -c ossl_x509store.c
gcc -I. -I. -I/usr/lib/ruby/1.8/x86_64-linux -I. -DRUBY_EXTCONF_H=\"extconf.h\" -I/usr/local/openssl/include    -fPIC -g -O2   -c ossl_x509req.c
gcc -I. -I. -I/usr/lib/ruby/1.8/x86_64-linux -I. -DRUBY_EXTCONF_H=\"extconf.h\" -I/usr/local/openssl/include    -fPIC -g -O2   -c ossl_ocsp.c
ossl_ocsp.c: In function ‘ossl_ocspreq_initialize’:
ossl_ocsp.c:114: 警告: passing argument 2 of ‘d2i_OCSP_REQUEST’ from incompatible pointer type
ossl_ocsp.c: In function ‘ossl_ocspres_initialize’:
ossl_ocsp.c:321: 警告: passing argument 2 of ‘d2i_OCSP_RESPONSE’ from incompatible pointer type
gcc -I. -I. -I/usr/lib/ruby/1.8/x86_64-linux -I. -DRUBY_EXTCONF_H=\"extconf.h\" -I/usr/local/openssl/include    -fPIC -g -O2   -c ossl_pkcs7.c
ossl_pkcs7.c: In function ‘ossl_pkcs7si_new’:
ossl_pkcs7.c:89: 警告: passing argument 2 of ‘ASN1_dup’ from incompatible pointer type
ossl_pkcs7.c: In function ‘DupPKCS7SignerPtr’:
ossl_pkcs7.c:102: 警告: passing argument 2 of ‘ASN1_dup’ from incompatible pointer type
ossl_pkcs7.c: In function ‘ossl_pkcs7ri_new’:
ossl_pkcs7.c:115: 警告: passing argument 2 of ‘ASN1_dup’ from incompatible pointer type
ossl_pkcs7.c: In function ‘DupPKCS7RecipientPtr’:
ossl_pkcs7.c:128: 警告: passing argument 2 of ‘ASN1_dup’ from incompatible pointer type
gcc -I. -I. -I/usr/lib/ruby/1.8/x86_64-linux -I. -DRUBY_EXTCONF_H=\"extconf.h\" -I/usr/local/openssl/include    -fPIC -g -O2   -c ossl_x509.c
gcc -I. -I. -I/usr/lib/ruby/1.8/x86_64-linux -I. -DRUBY_EXTCONF_H=\"extconf.h\" -I/usr/local/openssl/include    -fPIC -g -O2   -c ossl_x509revoked.c
ossl_x509revoked.c: In function ‘ossl_x509revoked_new’:
ossl_x509revoked.c:48: 警告: passing argument 2 of ‘ASN1_dup’ from incompatible pointer type
ossl_x509revoked.c: In function ‘DupX509RevokedPtr’:
ossl_x509revoked.c:64: 警告: passing argument 2 of ‘ASN1_dup’ from incompatible pointer type
gcc -I. -I. -I/usr/lib/ruby/1.8/x86_64-linux -I. -DRUBY_EXTCONF_H=\"extconf.h\" -I/usr/local/openssl/include    -fPIC -g -O2   -c ossl_cipher.c
ossl_cipher.c: In function ‘ossl_cipher_init’:
ossl_cipher.c:191: 警告: initialization discards qualifiers from pointer target type
ossl_cipher.c: In function ‘ossl_cipher_update_deprecated’:
ossl_cipher.c:314: 警告: assignment discards qualifiers from pointer target type
gcc -shared -o openssl.so ossl_x509crl.o ossl_ssl_session.o ossl_x509cert.o ossl_bio.o ossl_pkey_ec.o ossl_pkey_dh.o ossl_bn.o ossl_x509ext.o ossl_hmac.o ossl_rand.o ossl_pkey_rsa.o ossl.o openssl_missing.o ossl_ssl.o ossl_config.o ossl_pkcs5.o ossl_pkcs12.o ossl_x509name.o ossl_engine.o ossl_ns_spki.o ossl_x509attr.o ossl_pkey_dsa.o ossl_asn1.o ossl_pkey.o ossl_digest.o ossl_x509store.o ossl_x509req.o ossl_ocsp.o ossl_pkcs7.o ossl_x509.o ossl_x509revoked.o ossl_cipher.o -L. -L/usr/lib -Wl,-R/usr/lib -L/usr/local/openssl/lib -Wl,-R/usr/local/openssl/lib -L.  -rdynamic -Wl,-export-dynamic    -lssl -lcrypto  -lrt -ldl -lcrypt -lm   -lc
/usr/bin/ld: skipping incompatible /usr/lib/libssl.so when searching for -lssl
/usr/bin/ld: skipping incompatible /usr/lib/libssl.a when searching for -lssl
/usr/bin/ld: skipping incompatible /usr/lib/libcrypto.so when searching for -lcrypto
/usr/bin/ld: skipping incompatible /usr/lib/libcrypto.a when searching for -lcrypto
[root@localhost openssl]#
[root@localhost openssl]#
[root@localhost openssl]# make install
/usr/bin/install -c -m 0755 openssl.so /usr/lib/ruby/site_ruby/1.8/x86_64-linux
mkdir -p /usr/lib/ruby/site_ruby/1.8/net
mkdir -p /usr/lib/ruby/site_ruby/1.8/openssl
/usr/bin/install -c -m 644 ./lib/net/telnets.rb /usr/lib/ruby/site_ruby/1.8/net
/usr/bin/install -c -m 644 ./lib/net/ftptls.rb /usr/lib/ruby/site_ruby/1.8/net
/usr/bin/install -c -m 644 ./lib/openssl.rb /usr/lib/ruby/site_ruby/1.8
/usr/bin/install -c -m 644 ./lib/openssl/bn.rb /usr/lib/ruby/site_ruby/1.8/openssl
/usr/bin/install -c -m 644 ./lib/openssl/pkcs7.rb /usr/lib/ruby/site_ruby/1.8/openssl
/usr/bin/install -c -m 644 ./lib/openssl/ssl.rb /usr/lib/ruby/site_ruby/1.8/openssl
/usr/bin/install -c -m 644 ./lib/openssl/config.rb /usr/lib/ruby/site_ruby/1.8/openssl
/usr/bin/install -c -m 644 ./lib/openssl/digest.rb /usr/lib/ruby/site_ruby/1.8/openssl
/usr/bin/install -c -m 644 ./lib/openssl/ssl-internal.rb /usr/lib/ruby/site_ruby/1.8/openssl
/usr/bin/install -c -m 644 ./lib/openssl/x509.rb /usr/lib/ruby/site_ruby/1.8/openssl
/usr/bin/install -c -m 644 ./lib/openssl/cipher.rb /usr/lib/ruby/site_ruby/1.8/openssl
/usr/bin/install -c -m 644 ./lib/openssl/buffering.rb /usr/lib/ruby/site_ruby/1.8/openssl
/usr/bin/install -c -m 644 ./lib/openssl/x509-internal.rb /usr/lib/ruby/site_ruby/1.8/openssl
[root@localhost openssl]#



knife できたよ^-----





[root@localhost ~]# mkdir -p ~/chef-repo/.chef
[root@localhost ~]# mkdir -p ~/chef-repo/cookbooks
[root@localhost ~]# cd ~/chef-repo/.chef
[root@localhost .chef]# cp /media/sf_share/knife.rb .
[root@localhost .chef]# cp /media/sf_share/xxx.pem .
[root@localhost .chef]# cp /media/sf_share/xxx.pem .

vi knife.rbで以下を追加
http_proxy                "http://xxxxm:80"
https_proxy               "http://xxx:80"

require 'rest-client'
RestClient.proxy = "http://xxx:80"


mkdir /etc/chef
vi /etc/chef/solo.rb
以下を追加
home_path = ENV['HOME']
file_cache_path "#{home_path}/chef-repo"
cookbook_path "#{home_path}/chef-repo/cookbooks"

proxy setting for chef (knife)

I wanted to use knife commands to download and upload to chef hosts.

My chef version is 0.10.4.

1. Add "http_proxy", "https_proxy" to knife.rb. Only "http_proxy" will not do. Need both.
   See if knife works with "knife node list"
2. The above will do for just download but doesn't work for uploads.
   You will need to add" require 'rest-client'" and RestClient.proxy = "http://yourproxyserver:port"
   Test by "knife cookbook upload xxxxx"

Also, be sure to have ruby version 1.8.7 or above because uploading will not work with 1.8.6.
Because chef uses ruby's "tap" method and it is supported from 1.8.7.













**My knife.rb example************************





current_dir = File.dirname(__FILE__)
log_level                :debug
log_location             STDOUT
node_name                "xxx"
client_key               "#{current_dir}/xxx.pem"
validation_client_name   "xxx-validator"
validation_key           "#{current_dir}/xxx-validator.pem"
chef_server_url          "https://api.opscode.com/organizations/xxx"
cache_type               'BasicFile'
cache_options( :path => "#{ENV['HOME']}/.chef/checksums" )
cookbook_path            ["#{current_dir}/../cookbooks"]
http_proxy                "http://setyourproxyserver:80"
https_proxy               "http://setyourproxyserver:80"

require 'rest-client'
RestClient.proxy = "http://setyourproxyserver:80"




**************************************************


2011年8月10日水曜日

centos からインスタンス作成後にやる必要のある設定


cookbookでs3cmdを使っているとエラーする。

s3ダウンロードのための設定ができていないので、行う必要がある。詳しくは
s3のファイルをダウンロードする方法

以下2点設定するとOKになった。
・ /etc/s3conf/s3config.ymlにawsのアクセスキーを設定
・export AWS_CALLING_FORMAT="SUBDOMAIN"

2011年8月9日火曜日

chef今後のタスク

weblogic
レシピ
サイレントインストール
template でattributeを使えるようにするだけ
ドメイン作成
wlstオフラインで作成。
そのためには、wlst用の環境変数をセットする。
また、ドメイン作成のpyファイル作成して実行。
サーバー作成
サーバー作成のpyファイル。サーバー名とポートはノードattributeから取得。
クラスタ作成
クラスタ作成のpyファイル。ターゲットサーバーはattribute。
webサーバー連携設定
デプロイ
s3からwarダウンロードしてそれをwlstのデプロイコマンド
起動


cohe
レシピ

インストール
ec2設定
pof使用設定
起動
テストケース


oracle linux へのchefいんすとーる

tux
soloで。



templateに対して任意の値をセットするにはどうすればいいか?

マニュアルに書いてある
http://wiki.opscode.com/display/chef/Templates

attributeを使いたい場合

 <%= %>の間にattributeを入れる 

attribute例

 node[:fqdn] = "latte"

reciepeの中のresourceのvariablesにセットする場合
 <%= @ %>の間に変数名を入れる

resource例
template "/tmp/foo" do
  source "foo.erb"
  variables({
    :x_men => "are keen"
  })
end

サンプルtemplate

The node <%= node[:fqdn] %> thinks the x-men <%= @x_men %>
 

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です。

2011年7月21日木曜日

weblogicとcoherenceのインストール

[root@ip-10-150-183-203 recipes]# knife cookbook list
WebLogic           0.0.1
chef-client        0.99.5
coherence          0.0.1
coherence_inst_1   0.0.1
[root@ip-10-150-183-203 recipes]# knife node list
  demo.example.net2
  ip-10-146-7-97.ap-northeast-1.compute.internal
[root@ip-10-150-183-203 recipes]#
[root@ip-10-150-183-203 recipes]# knife node run_list
FATAL: Cannot find sub command for: 'node run_list'
Available node subcommands: (for details, knife SUB-COMMAND --help)

** NODE COMMANDS **
knife node from file FILE (options)
knife node show NODE (options)
knife node create NODE (options)
knife node run_list add [NODE] [ENTRY] (options)
knife node bulk delete REGEX (options)
knife node list (options)
knife node edit NODE (options)
knife node run_list remove [NODE] [ENTRY] (options)
knife node delete NODE (options)

[root@ip-10-150-183-203 recipes]# knife node show  demo.example.net2
Node Name:   demo.example.net2
Environment: _default
FQDN:        ip-10-150-183-203.ap-northeast-1.compute.internal
IP:          10.150.183.203
Run List:    recipe[WebLogic::install_10.3.5], recipe[coherence]
Roles:
Recipes      coherence_inst_1
Platform:    centos 5.5
[root@ip-10-150-183-203 recipes]#











[root@ip-10-150-183-203 ~] chef-client

ラン後。各製品ごとのサブディレクトリを作成しないといけなかった。。。

[root@ip-10-150-183-203 ~]# ls -ltr
total 80
drwxr-xr-x  5 root root  4096 Apr  1 22:17 wlserver
-rw-r--r--  1 root root  1138 Apr  1 22:17 registry.template
-rw-r--r--  1 root root  3189 Apr  1 22:17 configure.xml
-rw-r--r--  1 root root  1421 Apr  1 22:17 configure.cmd
drwxr-xr-x  5 root root 36864 Apr  1 22:17 modules
drwxr-xr-x  3 root root  4096 Apr  1 22:17 utils
-rw-r--r--  1 root root   133 Apr  1 22:17 domain-registry.xml
-rwxr-x---  1 root root  1370 Apr  1 22:17 configure.sh
-rw-r--r--  1 root root    33 Apr  6 12:33 README.txt
drwxr-xr-x 10 root root  4096 Jul 19 02:17 chef-repo
drwxr-xr-x  2 root root  4096 Jul 19 07:10 aws
drwxr-xr-x  5 root root  4096 Jul 20 07:55 coherence
[root@ip-10-150-183-203 ~]#






サブディレクトリが作成されるようにcookbook修正。
また、unzip時に同じファイルがあると、上書きするか聞かれるので、-oオプションで強制上書きにする。

[root@ip-10-150-183-203 ~]# ls
README.txt  coherence      configure.xml        registry.template
aws         configure.cmd  domain-registry.xml  utils
chef-repo   configure.sh   modules              wlserver
[root@ip-10-150-183-203 ~]# cd chef-repo/cookbooks/coherence/recipes/
[root@ip-10-150-183-203 recipes]# ls
default.rb  install_3.7.0.rb
[root@ip-10-150-183-203 recipes]# vi install_3.7.0.rb
[root@ip-10-150-183-203 recipes]# cat install_3.7.0.rb
#
# Cookbook Name:: coherence_inst_1
# Recipe:: default
#
# Copyright 2011, YOUR_COMPANY_NAME
#
# All rights reserved - Do Not Redistribute
#

execute "download_coherence" do
  command "s3cmd get 1-1-16-1019:coherence-java-3.7.0.0b23397.zip coherence.zip"
  creates "/home/s3sync/coherence.zip"
  action :run
end

directory "/root/coherence" do
  owner "root"
  group "root"
  mode "0755"
  action :create
end

execute "unzip_coherence.zip" do
  command "unzip -o /home/s3sync/coherence.zip -d /root/coherence"
  creates "/root/coherence/README.txt"
  action :run
end



[root@ip-10-150-183-203 recipes]# cd ~/chef-repo/cookbooks/WebLogic/recipes/
[root@ip-10-150-183-203 recipes]# ls
default.rb  install_10.3.5.rb

[root@ip-10-150-183-203 recipes]# cat install_10.3.5.rb
#
# Cookbook Name:: WebLogic
# Recipe:: default
#
# Copyright 2011, YOUR_COMPANY_NAME
#
# All rights reserved - Do Not Redistribute
#
execute "download_coherence" do
  command "s3cmd get 1-1-16-1019:wls1035_dev_linux_x86.zip weblogic.zip"
  creates "/home/s3sync/weblogic.zip"
  action :run
end

directory "/root/weblogic" do
  owner "root"
  group "root"
  mode "0755"
  action :create
end

execute "unzip_weblogic.zip" do
  command "unzip -o /home/s3sync/weblogic.zip -e /root/weblogic"
  action :run
end







[root@ip-10-150-183-203 ~]# ls
README.txt  coherence      configure.xml        registry.template
aws         configure.cmd  domain-registry.xml  utils
chef-repo   configure.sh   modules              wlserver
[root@ip-10-150-183-203 ~]# rm README.txt
[root@ip-10-150-183-203 ~]# rm -r coherence/
[root@ip-10-150-183-203 ~]# rm -r configure.cmd
[root@ip-10-150-183-203 ~]# rm configure.sh
[root@ip-10-150-183-203 ~]# rm -r modules/
[root@ip-10-150-183-203 ~]# rm configure.xml
[root@ip-10-150-183-203 ~]# rm domain-registry.xml
[root@ip-10-150-183-203 ~]# rm registry.template
[root@ip-10-150-183-203 ~]# rm -r utils/
[root@ip-10-150-183-203 ~]# rm -r wlserver/
[root@ip-10-150-183-203 ~]# ls
aws  chef-repo
[root@ip-10-150-183-203 ~]# chef-
chef-client  chef-solo
[root@ip-10-150-183-203 ~]# chef-client > chef-client.log 2>&1

 [root@ip-10-150-183-203 ~]# ls
README.txt       chef-repo      configure.xml        registry.template
aws              configure.cmd  domain-registry.xml  utils
chef-client.log  configure.sh   modules              wlserver
[root@ip-10-150-183-203 ~]#

アップロードし忘れた!

[root@ip-10-150-183-203 ~]# cd chef-repo/

[root@ip-10-150-183-203 chef-repo]# knife cookbook upload coherence
Uploading coherence             [0.0.1]
upload complete


[root@ip-10-150-183-203 chef-repo]# knife cookbook upload WebLogic
Uploading WebLogic             [0.0.1]
upload complete






[root@ip-10-150-183-203 ~]# chef-client | tee chef-client.log
[Wed, 20 Jul 2011 22:29:37 -0400] INFO: *** Chef 0.10.2 ***
[Wed, 20 Jul 2011 22:29:38 -0400] INFO: Run List is [recipe[WebLogic::install_10              .3.5], recipe[coherence]]
[Wed, 20 Jul 2011 22:29:38 -0400] INFO: Run List expands to [WebLogic::install_1              0.3.5, coherence]
[Wed, 20 Jul 2011 22:29:38 -0400] INFO: Starting Chef Run for demo.example.net2
[Wed, 20 Jul 2011 22:29:40 -0400] INFO: Loading cookbooks [WebLogic, coherence]
[Wed, 20 Jul 2011 22:29:41 -0400] INFO: Storing updated cookbooks/coherence/reci              pes/install_3.7.0.rb in the cache.
[Wed, 20 Jul 2011 22:29:42 -0400] INFO: Storing updated cookbooks/WebLogic/recip              es/install_10.3.5.rb in the cache.
[Wed, 20 Jul 2011 22:29:42 -0400] INFO: Processing execute[download_coherence] a              ction run (WebLogic::install_10.3.5 line 9)
[Wed, 20 Jul 2011 22:29:42 -0400] INFO: Processing directory[/root/weblogic] act              ion create (WebLogic::install_10.3.5 line 15)
[Wed, 20 Jul 2011 22:29:42 -0400] INFO: directory[/root/weblogic] created direct              ory /root/weblogic
[Wed, 20 Jul 2011 22:29:42 -0400] INFO: directory[/root/weblogic] owner changed               to 0
[Wed, 20 Jul 2011 22:29:42 -0400] INFO: directory[/root/weblogic] group changed               to 0
[Wed, 20 Jul 2011 22:29:42 -0400] INFO: directory[/root/weblogic] mode changed t              o 755
[Wed, 20 Jul 2011 22:29:42 -0400] INFO: Processing execute[unzip_weblogic.zip] a              ction run (WebLogic::install_10.3.5 line 22)
[Wed, 20 Jul 2011 22:29:42 -0400] INFO: execute[unzip_weblogic.zip] sh(unzip -o               /home/s3sync/weblogic.zip -e /root/weblogic)
[Wed, 20 Jul 2011 22:29:42 -0400] ERROR: execute[unzip_weblogic.zip] (WebLogic::              install_10.3.5 line 22) has had an error
[Wed, 20 Jul 2011 22:29:42 -0400] ERROR: Running exception handlers
[Wed, 20 Jul 2011 22:29:42 -0400] FATAL: Saving node information to /var/chef/ca              che/failed-run-data.json
[Wed, 20 Jul 2011 22:29:42 -0400] ERROR: Exception handlers complete
[Wed, 20 Jul 2011 22:29:42 -0400] FATAL: Stacktrace dumped to /var/chef/cache/ch              ef-stacktrace.out
[Wed, 20 Jul 2011 22:29:42 -0400] FATAL: Chef::Exceptions::ShellCommandFailed: e              xecute[unzip_weblogic.zip] (WebLogic::install_10.3.5 line 22) had an error: Expe              cted process to exit 0, but it exited with 11
---- Begin output of unzip -o /home/s3sync/weblogic.zip -e /root/weblogic ----
STDOUT: Archive:  /home/s3sync/weblogic.zip
STDERR: caution: filename not matched:  -e
caution: filename not matched:  /root/weblogic
---- End output of unzip -o /home/s3sync/weblogic.zip -e /root/weblogic ----
Ran unzip -o /home/s3sync/weblogic.zip -e /root/weblogic returned 11
[root@ip-10-150-183-203 ~]#
[root@ip-10-150-183-203 ~]# ;s
-bash: syntax error near unexpected token `;'
[root@ip-10-150-183-203 ~]# ls
aws  chef-client.log  chef-repo  weblogic
[root@ip-10-150-183-203 ~]# unzip -o /home/s3sync/weblogic.zip -e /root/weblogic
Archive:  /home/s3sync/weblogic.zip
caution: filename not matched:  -e
caution: filename not matched:  /root/weblogic
[root@ip-10-150-183-203 ~]#
[root@ip-10-150-183-203 ~]# unzip
UnZip 5.52 of 28 February 2005, by Info-ZIP.  Maintained by C. Spieler.  Send
bug reports using http://www.info-zip.org/zip-bug.html; see README for details.

Usage: unzip [-Z] [-opts[modifiers]] file[.zip] [list] [-x xlist] [-d exdir]
  Default action is to extract files in list, except those in xlist, to exdir;
  file[.zip] may be a wildcard.  -Z => ZipInfo mode ("unzip -Z" for usage).

  -p  extract files to pipe, no messages     -l  list files (short format)
  -f  freshen existing files, create none    -t  test compressed archive data
  -u  update files, create if necessary      -z  display archive comment
  -x  exclude files that follow (in xlist)   -d  extract files into exdir

modifiers:                                   -q  quiet mode (-qq => quieter)
  -n  never overwrite existing files         -a  auto-convert any text files
  -o  overwrite files WITHOUT prompting      -aa treat ALL files as text
  -j  junk paths (do not make directories)   -v  be verbose/print version info
  -C  match filenames case-insensitively     -L  make (some) names lowercase
  -X  restore UID/GID info                   -V  retain VMS version numbers
  -K  keep setuid/setgid/tacky permissions   -M  pipe through "more" pager
Examples (see unzip.txt for more info):
  unzip data1 -x joe   => extract all files except joe from zipfile data1.zip
  unzip -p foo | more  => send contents of foo.zip via pipe into program more
  unzip -fo foo ReadMe => quietly replace existing ReadMe if archive file newer
[root@ip-10-150-183-203 ~]#
[root@ip-10-150-183-203 ~]#


unzipコマンドのオプションを間違えました。-dであるべき
 [root@ip-10-150-183-203 recipes]# cat install_10.3.5.rb
#
# Cookbook Name:: WebLogic
# Recipe:: default
#
# Copyright 2011, YOUR_COMPANY_NAME
#
# All rights reserved - Do Not Redistribute
#
execute "download_coherence" do
  command "s3cmd get 1-1-16-1019:wls1035_dev_linux_x86.zip weblogic.zip"
  creates "/home/s3sync/weblogic.zip"
  action :run
end

directory "/root/weblogic" do
  owner "root"
  group "root"
  mode "0755"
  action :create
end

execute "unzip_weblogic.zip" do
  command "unzip -o /home/s3sync/weblogic.zip -d /root/weblogic"
  action :run
end

[root@ip-10-150-183-203 recipes]# knife cookbook upload WebLogic
Uploading WebLogic             [0.0.1]
upload complete
[root@ip-10-150-183-203 recipes]#


[root@ip-10-150-183-203 recipes]# chef-client | tee chef-client.log
[Wed, 20 Jul 2011 22:34:52 -0400] INFO: *** Chef 0.10.2 ***
[Wed, 20 Jul 2011 22:34:53 -0400] INFO: Run List is [recipe[WebLogic::install_10.3.5], recipe[coherence]]
[Wed, 20 Jul 2011 22:34:53 -0400] INFO: Run List expands to [WebLogic::install_10.3.5, coherence]
[Wed, 20 Jul 2011 22:34:53 -0400] INFO: Starting Chef Run for demo.example.net2
[Wed, 20 Jul 2011 22:34:55 -0400] INFO: Loading cookbooks [WebLogic, coherence]
[Wed, 20 Jul 2011 22:34:56 -0400] INFO: Storing updated cookbooks/WebLogic/recipes/install_10.3.5.rb in the cache.
[Wed, 20 Jul 2011 22:34:56 -0400] INFO: Processing execute[download_coherence] action run (WebLogic::install_10.3.5 line 9)
[Wed, 20 Jul 2011 22:34:56 -0400] INFO: Processing directory[/root/weblogic] action create (WebLogic::install_10.3.5 line 15)
[Wed, 20 Jul 2011 22:34:56 -0400] INFO: directory[/root/weblogic] created directory /root/weblogic
[Wed, 20 Jul 2011 22:34:56 -0400] INFO: directory[/root/weblogic] owner changed to 0
[Wed, 20 Jul 2011 22:34:56 -0400] INFO: directory[/root/weblogic] group changed to 0
[Wed, 20 Jul 2011 22:34:56 -0400] INFO: directory[/root/weblogic] mode changed to 755
[Wed, 20 Jul 2011 22:34:56 -0400] INFO: Processing execute[unzip_weblogic.zip] action run (WebLogic::install_10.3.5 line 22)
[Wed, 20 Jul 2011 22:34:56 -0400] INFO: execute[unzip_weblogic.zip] sh(unzip -o /home/s3sync/weblogic.zip -d /root/weblogic)
[Wed, 20 Jul 2011 22:35:19 -0400] INFO: execute[unzip_weblogic.zip] ran successfully
[Wed, 20 Jul 2011 22:35:23 -0400] INFO: Chef Run complete in 29.90074 seconds
[Wed, 20 Jul 2011 22:35:23 -0400] INFO: Running report handlers
[Wed, 20 Jul 2011 22:35:23 -0400] INFO: Report handlers complete
[root@ip-10-150-183-203 recipes]#

あーーー、coherenceで適用されたのがdefault.rbだ。
install_3.7.0レシピをrun_listに変更しないと。
weblogicはうまくいったようだ。ただ、recipeの名前がdownload_coherenceのままだ。


今までnodeのrun_listにrecipeを直接指定していたが、roleを作成してroleを指定するようにする。
[root@ip-10-150-183-203 recipes]# knife role create coherenceWeb
Created role[coherenceWeb]
[root@ip-10-150-183-203 recipes]# knife role show coherenceWeb
chef_type:            role
default_attributes:
description:
env_run_lists:
json_class:           Chef::Role
name:                 coherenceWeb
override_attributes:
run_list:             recipe[coherence::install_3.7.0], recipe[WebLogic::install_10.3.5]
[root@ip-10-150-183-203 recipes]#


[root@ip-10-150-183-203 recipes]# knife node run_list add demo.example.net2 role[coherenceWeb]
run_list:  role[coherenceWeb]







[root@ip-10-150-183-203 ~]# chef-client | tee chef-client.log
[Wed, 20 Jul 2011 23:00:00 -0400] INFO: *** Chef 0.10.2 ***
[Wed, 20 Jul 2011 23:00:04 -0400] INFO: Run List is [role[coherenceWeb]]
[Wed, 20 Jul 2011 23:00:04 -0400] INFO: Run List expands to [coherence::install_3.7.0, WebLogic::install_10.3.5]
[Wed, 20 Jul 2011 23:00:04 -0400] INFO: Starting Chef Run for demo.example.net2
[Wed, 20 Jul 2011 23:00:07 -0400] INFO: Loading cookbooks [WebLogic, coherence]
[Wed, 20 Jul 2011 23:00:08 -0400] INFO: Storing updated cookbooks/WebLogic/recipes/install_10.3.5.rb in the cache.
[Wed, 20 Jul 2011 23:00:08 -0400] INFO: Processing execute[download_coherence] action run (coherence::install_3.7.0 line 10)
[Wed, 20 Jul 2011 23:00:08 -0400] INFO: Processing directory[/root/coherence] action create (coherence::install_3.7.0 line 16)
[Wed, 20 Jul 2011 23:00:08 -0400] INFO: directory[/root/coherence] created directory /root/coherence
[Wed, 20 Jul 2011 23:00:08 -0400] INFO: directory[/root/coherence] owner changed to 0
[Wed, 20 Jul 2011 23:00:08 -0400] INFO: directory[/root/coherence] group changed to 0
[Wed, 20 Jul 2011 23:00:08 -0400] INFO: directory[/root/coherence] mode changed to 755
[Wed, 20 Jul 2011 23:00:08 -0400] INFO: Processing execute[unzip_coherence.zip] action run (coherence::install_3.7.0 line 23)
[Wed, 20 Jul 2011 23:00:08 -0400] INFO: execute[unzip_coherence.zip] sh(unzip -o /home/s3sync/coherence.zip -d /root/coherence)
[Wed, 20 Jul 2011 23:00:11 -0400] INFO: execute[unzip_coherence.zip] ran successfully
[Wed, 20 Jul 2011 23:00:11 -0400] INFO: Processing execute[download install zip file] action run (WebLogic::install_10.3.5 line 9)
[Wed, 20 Jul 2011 23:00:11 -0400] INFO: Processing directory[/root/weblogic] action create (WebLogic::install_10.3.5 line 15)
[Wed, 20 Jul 2011 23:00:11 -0400] INFO: Processing execute[unzip_weblogic.zip] action run (WebLogic::install_10.3.5 line 22)
[Wed, 20 Jul 2011 23:00:11 -0400] INFO: execute[unzip_weblogic.zip] sh(unzip -o /home/s3sync/weblogic.zip -d /root/weblogic)
[Wed, 20 Jul 2011 23:01:08 -0400] INFO: execute[unzip_weblogic.zip] ran successfully
[Wed, 20 Jul 2011 23:01:11 -0400] INFO: Chef Run complete in 66.688934 seconds
[Wed, 20 Jul 2011 23:01:11 -0400] INFO: Running report handlers
[Wed, 20 Jul 2011 23:01:11 -0400] INFO: Report handlers complete
[root@ip-10-150-183-203 ~]# ls
aws  chef-client.log  chef-repo  coherence  weblogic
[root@ip-10-150-183-203 ~]# ls coherence/
README.txt  coherence
[root@ip-10-150-183-203 ~]# ls weblogic/
README.txt     configure.sh   domain-registry.xml  registry.template  wlserver
configure.cmd  configure.xml  modules              utils
[root@ip-10-150-183-203 ~]#


うまくいった!


もういっかいchef runするとどうかなるか試す。
[root@ip-10-150-183-203 ~]# chef-client | tee chef-client.log
[Wed, 20 Jul 2011 23:03:53 -0400] INFO: *** Chef 0.10.2 ***
[Wed, 20 Jul 2011 23:03:57 -0400] INFO: Run List is [role[coherenceWeb]]
[Wed, 20 Jul 2011 23:03:57 -0400] INFO: Run List expands to [coherence::install_3.7.0, WebLogic::install_10.3.5]
[Wed, 20 Jul 2011 23:03:57 -0400] INFO: Starting Chef Run for demo.example.net2
[Wed, 20 Jul 2011 23:03:58 -0400] INFO: Loading cookbooks [WebLogic, coherence]
[Wed, 20 Jul 2011 23:03:58 -0400] INFO: Processing execute[download_coherence] action run (coherence::install_3.7.0 line 10)
[Wed, 20 Jul 2011 23:03:58 -0400] INFO: Processing directory[/root/coherence] action create (coherence::install_3.7.0 line 16)
[Wed, 20 Jul 2011 23:03:58 -0400] INFO: Processing execute[unzip_coherence.zip] action run (coherence::install_3.7.0 line 23)
[Wed, 20 Jul 2011 23:03:58 -0400] INFO: Processing execute[download install zip file] action run (WebLogic::install_10.3.5 line 9)
[Wed, 20 Jul 2011 23:03:58 -0400] INFO: Processing directory[/root/weblogic] action create (WebLogic::install_10.3.5 line 15)
[Wed, 20 Jul 2011 23:03:58 -0400] INFO: Processing execute[unzip_weblogic.zip] action run (WebLogic::install_10.3.5 line 22)
[Wed, 20 Jul 2011 23:03:58 -0400] INFO: execute[unzip_weblogic.zip] sh(unzip -o /home/s3sync/weblogic.zip -d /root/weblogic)
[Wed, 20 Jul 2011 23:04:18 -0400] INFO: execute[unzip_weblogic.zip] ran successfully
[Wed, 20 Jul 2011 23:04:20 -0400] INFO: Chef Run complete in 22.964632 seconds
[Wed, 20 Jul 2011 23:04:20 -0400] INFO: Running report handlers
[Wed, 20 Jul 2011 23:04:20 -0400] INFO: Report handlers complete

既にあるファイルがスキップされたとは書いていないが、実行時間が1/3になっている。