しょんぼり技術メモ

まいにちがしょんぼり

SL6.1にRuby 1.9(rpm) + Rails3 環境を作る

Scientific Linux 6.1のslリポジトリにあるRubyは1.8.7なので、自分で1.9のrpmを作ってインストールしてみた。

環境

$ cat /etc/redhat-release 
Scientific Linux release 6.1 (Carbon)

checkinstallのインストール

$ git clone http://checkinstall.izto.org/checkinstall.git
$ cd checkinstall
# make
# make install

rubyrpmを作成

$ wget ftp://ftp.ruby-lang.org/pub/ruby/1.9/ruby-1.9.2-p290.tar.bz2
$ tar jxf ruby-1.9.2-p290.tar.bz2
$ cd ruby-1.9.2-p290
$ ./configure --prefix=/usr/local
$ make

# LANG=C /usr/local/sbin/checkinstall -fstrans=no

こんな感じで 
This package will be built according to these values:

1 -  Summary: [ ruby 1.9.2 ]
2 -  Name:    [ ruby ]
3 -  Version: [ 1.9.2 ]
4 -  Release: [ p290 ]
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

 /root/rpmbuild/RPMS/x86_64/ruby-1.9.2-p290.x86_64.rpm
 You can install it in your system anytime using:

      rpm -i ruby-1.9.2-p290.x86_64.rpm

**********************************************************************
# yum localinstall /root/rpmbuild/RPMS/x86_64/ruby-1.9.2-p290.x86_64.rpm

Ruby on Rails 3のインストール

$ which ruby
/usr/local/bin/ruby
$ ruby --version
ruby 1.9.2p290 (2011-07-09 revision 32553) [x86_64-linux]
$ which gem
/usr/local/bin/gem
# gem install rails
Depending on your version of ruby, you may need to install ruby rdoc/ri data:

<= 1.8.6 : unsupported
 = 1.8.7 : gem install rdoc-data; rdoc-data --install
 = 1.9.1 : gem install rdoc-data; rdoc-data --install
>= 1.9.2 : nothing to do! Yay!
Successfully installed activesupport-3.0.10
Successfully installed builder-2.1.2
Successfully installed i18n-0.5.0
Successfully installed activemodel-3.0.10
Successfully installed rack-1.2.3
Successfully installed rack-test-0.5.7
Successfully installed rack-mount-0.6.14
Successfully installed tzinfo-0.3.29
Successfully installed abstract-1.0.0
Successfully installed erubis-2.6.6
Successfully installed actionpack-3.0.10
Successfully installed arel-2.0.10
Successfully installed activerecord-3.0.10
Successfully installed activeresource-3.0.10
Successfully installed mime-types-1.16
Successfully installed polyglot-0.3.2
Successfully installed treetop-1.4.10
Successfully installed mail-2.2.19
Successfully installed actionmailer-3.0.10
Successfully installed thor-0.14.6
Successfully installed rdoc-3.9.3
Successfully installed railties-3.0.10
Successfully installed bundler-1.0.18
Successfully installed rails-3.0.10
24 gems installed
$ rails --version
Rails 3.0.10

追記 09/10 14:52

prefix=/usrでインストールしたところ、2回目以降の実行でSEGVで死んでしまう状態になってしまったので、アンインストールして/usr/localにしたら直った。よくわからないけど、とりあえず修正しておきます。