構成
CentOS |
release 5.6 (Final) |
checkinstall |
1.6.2, Copyright 2009 Felipe Eduardo Sanchez Diaz Duran |
ruby |
1.9.2p290 (2011-07-09 revision 32553) [x86_64-linux] |
準備
依存パッケージをインストールします。
# yum --disableplugin=priorities install gcc.x86_64 gcc-c++.x86_64 make.x86_64 perl.x86_64 --exclude=*.i386
...
==================================================================================================
Package Arch Version Repository Size
==================================================================================================
Installing:
bzip2-devel x86_64 1.0.3-6.el5_5 base 38 k
freetype-devel x86_64 2.2.1-28.el5_5.1 base 148 k
libjpeg-devel x86_64 6b-37 base 105 k
libpng-devel x86_64 2:1.2.10-7.1.el5_5.3 base 184 k
readline-devel x86_64 5.1-3.el5 base 159 k
unzip x86_64 5.52-3.el5 base 165 k
Installing for dependencies:
libtermcap-devel x86_64 2.0.8-46.1 base 56 k
Transaction Summary
==================================================================================================
Install 7 Package(s)
Upgrade 0 Package(s)
# yum --disableplugin=priorities install openssl.x86_64 openssl-devel.x86_64
# yum --disableplugin=priorities install zlib.x86_64 zlib-devel.x86_64
# yum --disableplugin=priorities install readline.x86_64 readline-devel.x86_64
# yum --disableplugin=priorities install libyaml.x86_64 libyaml-devel.x86_64
# yum --disableplugin=priorities install libxml2.x86_64 libxml2-devel.x86_64
# yum --disableplugin=priorities install libxslt.x86_64 libxslt-devel.x86_64
checkinstallをインストールします。
re checkinstallのインストール
インストール
ソースコードをダウンロードし、RPMパッケージを作成します。最新のソースコードはftp://ftp.ruby-lang.org/pub/ruby/からダウンロードできます。
# cd /usr/local/src
# wget ftp://ftp.ruby-lang.org/pub/ruby/1.9/ruby-1.9.2-p290.tar.gz
# tar xvzf ruby-1.9.2-p290.tar.gz
# cd ruby-1.9.2-p290
# ./configure
# make
# checkinstall --fstrans=no
途中、パッケージ方式を質問されるので、[R]を押してRPMパッケージを選択します。それ以外の質問はデフォルトのまま([Enter]を空打ち)で問題ありません。
Please choose the packaging method you want to use.
Slackware [S], RPM [R] or Debian [D]?
最後に確認を求められるので、間違いがないか確認します。
**************************************
**** RPM package creation selected ***
**************************************
This package will be built according to these values:
1 - Summary: [ Package created with checkinstall 1.6.2 ]
2 - Name: [ ruby-1.9.2 ]
3 - Version: [ p290 ]
4 - Release: [ 1 ]
5 - License: [ GPL ]
6 - Group: [ Applications/System ]
7 - Architecture: [ x86_64 ]
8 - Source location: [ ruby-1.9.2-p290 ]
9 - Alternate source location: [ ]
10 - Requires: [ ]
11 - Provides: [ ruby-1.9.2 ]
パッケージの作成に成功すると、以下のメッセージが表示されます。
**********************************************************************
Done. The new package has been saved to
/usr/src/redhat/RPMS/x86_64/ruby-1.9.2-p290-1.x86_64.rpm
You can install it in your system anytime using:
rpm -i ruby-1.9.2-p290-1.x86_64.rpm
**********************************************************************
インストールの確認
# ruby -v
ruby 1.9.2p290 (2011-07-09 revision 32553) [x86_64-linux]
パッケージ管理への追加
パッケージ管理に加えるため、作成されたRPMパッケージを使って上書きインストールします。
# rpm -ivh /usr/src/redhat/RPMS/x86_64/ruby-1.9.2-p290-1.x86_64.rpm
# rpm -qa | grep ruby
ruby-1.9.2-p290-1
標準ライブラリのインストール
標準ライブラリをインストールするには、Rubyのソースコードを展開したディレクトリにあるext/〜ディレクトリに移動し、以下の操作を実行します。
opensslのインストール
# yum --disableplugin=priorities install openssl.x86_64 openssl-devel.x86_64
# cd /usr/local/src/ruby-1.9.2-p290/ext/openssl
# ruby extconf.rb
# make
# make install
zlibのインストール
# yum --disableplugin=priorities install zlib.x86_64 zlib-devel.x86_64
# cd /usr/local/src/ruby-1.9.2-p290/ext/zlib
# ruby extconf.rb
# make
# make install
readlineのインストール
# yum --disableplugin=priorities install readline.x86_64 readline-devel.x86_64
# cd /usr/local/src/ruby-1.9.2-p290/ext/readline
# ruby extconf.rb
# make
# make install
付属するRubyGemsのバージョンは1.3.7です。
# gem --version
1.3.7
アップデートします。
# gem update --system
一気に1.8.11まで上がりました。
# gem --version
1.8.11
備考
The "rpm" program is not in your PATH!
checkinstallコマンドが以下のエラーメッセージを表示して失敗しました。
*** The "rpm" program is not in your PATH!
*** RPM package creation aborted
パッケージングに失敗しただけなので、インストールは無事に終わっています。
# ruby -v
ruby 1.9.2p290 (2011-07-09 revision 32553) [x86_64-linux]
原因はwhichコマンドがインストールされていなかったためでした。どうやら、whichコマンドを使ってrpmコマンドを探しているようです。
# which rpm
-bash: which: command not found
whichコマンドをインストールします。
# yum install which.x86_64
...
==================================================================================================
Package Arch Version Repository Size
==================================================================================================
Installing:
which x86_64 2.16-7 base 24 k
Transaction Summary
==================================================================================================
Install 1 Package(s)
Upgrade 0 Package(s)
作業ディレクトリには前回の情報がキャッシュされています。そのまま再実行しても同じエラーメッセージが表示されるだけなので、一度ディレクトリを削除してからやり直します。
# cd ..
# rm -rf ./ruby-1.9.2-p290
# tar xvzf ruby-1.9.2-p290.tar.gz
# cd ruby-1.9.2-p290
# ./configure
# make
# checkinstall --fstrans=no
成功しました。
**********************************************************************
Done. The new package has been saved to
/usr/src/redhat/RPMS/x86_64/ruby-1.9.2-p290-1.x86_64.rpm
You can install it in your system anytime using:
rpm -i ruby-1.9.2-p290-1.x86_64.rpm
**********************************************************************
bundler: command not found: ruby
最初、/usr/binディレクトリにシンボリックリンクを作成せずにbundle execを実行したところ、以下のようなエラーメッセージが表示されました。
# bundle exec ruby -v
bundler: command not found: ruby
Install missing gem executables with `bundle install`
bundlerがrubyコマンドを見つけることができなかったようです。rubyコマンドをフルパスで指定すると、正常に実行できました。
# bundle exec /usr/local/bin/ruby -v
ruby 1.9.2p290 (2011-07-09 revision 32553) [x86_64-linux]
bundlerがrubyコマンドを見つけることができるように、/usr/bin/rubyディレクトリにシンボリックリンクを作成します。
# ln -s /usr/local/bin/ruby /usr/bin/ruby
正常に実行できました。
# bundle exec ruby -v
ruby 1.9.2p290 (2011-07-09 revision 32553) [x86_64-linux]
Makefile wasn't created. Fix the errors above.
opensslがインストールされていないと、ruby extconf.rbコマンドが次のエラーメッセージを表示します。
# ruby extconf.rb
=== 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... no
=== Checking for required stuff failed. ===
Makefile wasn't created. Fix the errors above.
no such file to load -- openssl (LoadError)
標準ライブラリがインストールされていないと、実行時に次のようなエラーメッセージが表示されることがあります。以下はCapistranoを使ってデプロイしようとしたところ、表示されたエラーメッセージです。
$ cap production deploy:setup
<internal:lib/rubygems/custom_require>:29:in `require': no such file to load -- openssl (LoadError)
from <internal:lib/rubygems/custom_require>:29:in `require'
from /usr/local/lib/ruby/gems/1.9.1/gems/net-ssh-2.2.1/lib/net/ssh/transport/openssl.rb:1:in `<top (required)>'
...
invalid date format in specification: "2011-09-24 00:00:00.000000000Z"
RubyGemsをアップデート後、次のようなエラーメッセージが表示されることがあります。
Invalid gemspec in [/usr/local/lib/ruby/gems/1.9.1/specifications/capistrano-2.9.0.gemspec]: invalid date format in specification: "2011-09-24 00:00:00.000000000Z"
gemspecファイルを開き、上記の日付フォーマットの行を書き換えます。
FILE: /usr/local/lib/ruby/gems/1.9.1/specifications/capistrano-2.9.0.gemspec
--- /usr/local/lib/ruby/gems/1.9.1/specifications/capistrano-2.9.0.gemspec 2011-10-25 18:29:23.000000000 +0900
+++ /usr/local/lib/ruby/gems/1.9.1/specifications/capistrano-2.9.0.gemspec 2011-10-25 18:29:49.000000000 +0900
@@ -6,7 +6,7 @@ Gem::Specification.new do |s|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
s.authors = ["Jamis Buck", "Lee Hambley"]
- s.date = %q{2011-09-24 00:00:00.000000000Z}
+ s.date = %q{2011-09-24}
s.description = %q{Capistrano is a utility and framework for executing commands in parallel on multiple remote machines, via SSH.}
s.email = ["jamis@jamisbuck.org", "lee.hambley@gmail.com"]
s.executables = ["cap", "capify"]
re Good night, Posterous