Amazon Linuxでserverspec-initができない(`require’: cannot load such file — io/console (LoadError))
Amazon Linuxでserverspecのインストールはできるが、
serverspec-initができない。
Amazon LinuxのAMI IDはamzn-ami-hvm-2017.03.0.20170417-x86_64-gp2 (ami-923d12f5)、
Rubyのバージョンはruby 2.0.0p648 (2015-12-16) [x86_64-linux]、
rakeのバージョンはrake, version 12.0.0。
serverspec-initを実行すると、
[ec2-user@ip-192-168-11-11 serverspec]$ serverspec-init
/usr/share/ruby/vendor_ruby/2.0/rubygems/core_ext/kernel_require.rb:55:in `require': cannot load such file -- io/console (LoadError)
from /usr/share/ruby/vendor_ruby/2.0/rubygems/core_ext/kernel_require.rb:55:in `require'
from /home/ec2-user/.gem/ruby/2.0/gems/net-ssh-4.1.0/lib/net/ssh/prompt.rb:1:in `
from /usr/share/ruby/vendor_ruby/2.0/rubygems/core_ext/kernel_require.rb:55:in `require'
from /usr/share/ruby/vendor_ruby/2.0/rubygems/core_ext/kernel_require.rb:55:in `require'
from /home/ec2-user/.gem/ruby/2.0/gems/net-ssh-4.1.0/lib/net/ssh/key_factory.rb:2:in `
from /usr/share/ruby/vendor_ruby/2.0/rubygems/core_ext/kernel_require.rb:55:in `require'
from /usr/share/ruby/vendor_ruby/2.0/rubygems/core_ext/kernel_require.rb:55:in `require'
from /home/ec2-user/.gem/ruby/2.0/gems/net-ssh-4.1.0/lib/net/ssh/authentication/key_manager.rb:2:in `
from /usr/share/ruby/vendor_ruby/2.0/rubygems/core_ext/kernel_require.rb:55:in `require'
from /usr/share/ruby/vendor_ruby/2.0/rubygems/core_ext/kernel_require.rb:55:in `require'
from /home/ec2-user/.gem/ruby/2.0/gems/net-ssh-4.1.0/lib/net/ssh/authentication/session.rb:4:in `
from /usr/share/ruby/vendor_ruby/2.0/rubygems/core_ext/kernel_require.rb:55:in `require'
from /usr/share/ruby/vendor_ruby/2.0/rubygems/core_ext/kernel_require.rb:55:in `require'
from /home/ec2-user/.gem/ruby/2.0/gems/net-ssh-4.1.0/lib/net/ssh.rb:12:in `
from /usr/share/ruby/vendor_ruby/2.0/rubygems/core_ext/kernel_require.rb:55:in `require'
from /usr/share/ruby/vendor_ruby/2.0/rubygems/core_ext/kernel_require.rb:55:in `require'
from /home/ec2-user/.gem/ruby/2.0/gems/specinfra-2.67.9/lib/specinfra/backend/ssh.rb:3:in `
from /usr/share/ruby/vendor_ruby/2.0/rubygems/core_ext/kernel_require.rb:55:in `require'
from /usr/share/ruby/vendor_ruby/2.0/rubygems/core_ext/kernel_require.rb:55:in `require'
from /home/ec2-user/.gem/ruby/2.0/gems/specinfra-2.67.9/lib/specinfra/backend.rb:3:in `
from /usr/share/ruby/vendor_ruby/2.0/rubygems/core_ext/kernel_require.rb:55:in `require'
from /usr/share/ruby/vendor_ruby/2.0/rubygems/core_ext/kernel_require.rb:55:in `require'
from /home/ec2-user/.gem/ruby/2.0/gems/specinfra-2.67.9/lib/specinfra/core.rb:7:in `
from /usr/share/ruby/vendor_ruby/2.0/rubygems/core_ext/kernel_require.rb:55:in `require'
from /usr/share/ruby/vendor_ruby/2.0/rubygems/core_ext/kernel_require.rb:55:in `require'
from /home/ec2-user/.gem/ruby/2.0/gems/specinfra-2.67.9/lib/specinfra.rb:1:in `
from /usr/share/ruby/vendor_ruby/2.0/rubygems/core_ext/kernel_require.rb:55:in `require'
from /usr/share/ruby/vendor_ruby/2.0/rubygems/core_ext/kernel_require.rb:55:in `require'
from /home/ec2-user/.gem/ruby/2.0/gems/serverspec-2.38.0/lib/serverspec.rb:2:in `
from /usr/share/ruby/vendor_ruby/2.0/rubygems/core_ext/kernel_require.rb:55:in `require'
from /usr/share/ruby/vendor_ruby/2.0/rubygems/core_ext/kernel_require.rb:55:in `require'
from /home/ec2-user/.gem/ruby/2.0/gems/serverspec-2.38.0/bin/serverspec-init:5:in `
from /home/ec2-user/bin/serverspec-init:23:in `load'
from /home/ec2-user/bin/serverspec-init:23:in `
となる。
ログを見て、ああ、io-consoleがないのね、と思い、gem install io-console するが、
[ec2-user@ip-192-168-11-11 serverspec]$ gem install io-console
Fetching: io-console-0.4.6.gem (100%)
Building native extensions. This could take a while...
ERROR: Error installing io-console:
ERROR: Failed to build gem native extension.
/usr/bin/ruby2.0 extconf.rb
mkmf.rb can't find header files for ruby at /usr/share/ruby/include/ruby.h
Gem files will remain installed in /home/ec2-user/.gem/ruby/2.0/gems/io-console-0.4.6 for inspection.
となる。
むむーーーーーー
[wp_ad_camp_3]
ヘッダーファイルがみつからない的なエラーが出ているため、
sudo yum -y install ruby-devel
したが変わらず。
それではということで、
sudo yum install -y ruby20-devel gcc-c++
したらio-consoleインストールできた!!!!!!!!!
というわけで、無事serverspec-initもできた。
最近のAmazon LinuxのRubyだと起きる・・?
売り上げランキング: 27,328