AMIのruby環境はあまりパッケージがインストールされていないので、mechanizeのインストールにつまずくことがある。
なので、ここに一連の手順を残しておく。
rubyバージョン ruby 2.0.0p481
1.yum install ruby-devel
2.yum install gcc-c++.noarch
3.yum install libxslt-devel.x86_64
4.yum install patch.x86_64
以下のような nokogoriやmechanizeをインストールするときに
以下のようなメッセージが出で失敗する事があるので
必ずインストールする。
patch.logを見ると、パッチコマンドが見つからないという趣旨のエラーが出力されている。
Running 'patch' for libxml2 2.9.2... ERROR, review '/home/ec2-user/.gem/ruby /2.0/gems/nokogiri-1.6.4.1/ext/nokogiri/tmp/x86_64-redhat-linux-gnu/ports /libxml2/2.9.2/patch.log' to see what happened.
*** 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.
5.gem install nokogiri
6.gem install mechanize
以上