プログラマでありたい

おっさんになっても、プログラマでありつづけたい

CentOS 5にRuby On Railsをインストールする

 CentOS 5へのRailsインストールの作業メモです。


CentOSのRPMが1.8.5-5と古いので、ソースからRPMを作ります。その後、RPMでインストールします。

# wget ftp://ftp.idaemons.org/pub/mirror/ftp.ruby-lang.org/ruby/1.8/ruby-1.8.7-p72.tar.gz〜略〜
# tar xzvf ruby-1.8.7-p72.tar.gz
# cd ruby-1.8.7-p72
# ./configure --prefix=/usr
# make
# checkinstall --fstrans=no

checkinstall 1.6.1, Copyright 2002 Felipe Eduardo Sanchez Diaz Duran
           This software is released under the GNU GPL.

The checkinstallrc file was not found at:
/usr/local/lib/checkinstall/checkinstallrc

Assuming default values.

The package documentation directory ./doc-pak does not exist.
Should I create a default set of package docs?  [y]: y

パッケージのドキュメンテーションを準備..OK

Please choose the packaging method you want to use.
Slackwareなら[S], RPMなら[R], Debianなら[D]を入力R


このパッケージの説明を書いてください
End your description with an empty line or EOF.
>>

**************************************
**** RPM package creation selected ***
**************************************

This package will be built according to these values:

1 -  Summary: [ Package created with checkinstall 1.6.1 ]
2 -  Name:    [ ruby-1.8.7 ]
3 -  Version: [ p72 ]
4 -  Release: [ 1 ]
5 -  License: [ GPL ]
6 -  Group:   [ Applications/System ]
7 -  Architecture: [ i386 ]
8 -  Source location: [ ruby-1.8.7-p72 ]
9 -  Alternate source location: [  ]
10 - Requires: [  ]
11 - Provides: [ ruby-1.8.7 ]

変更するものの番号を入力してください。Enterで続行します:

Installing with make install...

========================= Installation results ===========================
./miniruby -I./lib -I.ext/common -I./- -r./ext/purelib.rb  ./instruby.rb --make="make" --dest-dir="" --extout=".ext" --mflags="" --make-flags="" --data-mode=0644 --prog-mode=0755 --installed-list .installed.list --mantype="doc"
installing binary commands
installing command scripts
installing library scripts
installing headers
installing manpages
installing extension objects
installing extension scripts

======================== Installation successful ==========================

Copying documentation directory...
./
./doc/
./doc/irb/
./doc/irb/irb.rd.ja
./doc/irb/irb.rd
./doc/irb/irb-tools.rd.ja
./doc/shell.rd.ja
./doc/NEWS-1.8.0
./doc/forwardable.rd.ja
./doc/shell.rd
./doc/forwardable.rd
./doc/ChangeLog-1.8.0
./README
./COPYING
./NEWS
./README.EXT.ja
./COPYING.ja
./GPL
./README.ja
./ChangeLog
./README.EXT

Some of the files created by the installation are inside the build
directory: /usr/local/src/ruby-1.8.7-p72

You probably don't want them to be included in the package,
especially if they are inside your home directory.
Do you want me to list them?  [n]:
それらをパッケージから除外しますか?(yesと答えることをおすすめします) [y]: y

tempディレクトリにファイルをコピー..OK

ELFバイナリを除去..OK

manページを圧縮..OK

ファイルリストを作成..OK

RPMパッケージを作成..OK

NOTE: The package will not be installed

tempファイルを削除..OK

doc-pakディレクトリを削除..OK

バックアップパッケージを書き込み..OK

temp dirを削除..OK


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

 Done. The new package has been saved to

 /usr/src/redhat/RPMS/i386/ruby-1.8.7-p72-1.i386.rpm
 You can install it in your system anytime using:

      rpm -i ruby-1.8.7-p72-1.i386.rpm

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

# rpm -ihv --nomd5 /usr/src/redhat/RPMS/i386/ruby-1.8.7-p72-1.i386.rpm
# ruby --version
ruby 1.8.7 (2008-08-11 patchlevel 72) [i686-linux]

 同じくソースからrubygemsのRPMを作り、インストールします。

# wget http://rubyforge.org/frs/download.php/45905/rubygems-1.3.1.tgz
# tar xzvf rubygems-1.3.1.tgz
# cd rubygems-1.3.1
# checkinstall -R "ruby setup.rb"
略
# rpm -ihv --nomd5 /usr/src/redhat/RPMS/i386/rubygems-1.3.1-1.i386.rpm
# gem --version
1.3.1


 Railsはgemからインストールします。

# gem install rails
Successfully installed rake-0.8.3
Successfully installed activesupport-2.2.2
Successfully installed activerecord-2.2.2
Successfully installed actionpack-2.2.2
Successfully installed actionmailer-2.2.2
Successfully installed activeresource-2.2.2
Successfully installed rails-2.2.2
7 gems installed
Installing ri documentation for rake-0.8.3...
Installing ri documentation for activesupport-2.2.2...
Installing ri documentation for activerecord-2.2.2...
Installing ri documentation for actionpack-2.2.2...
Installing ri documentation for actionmailer-2.2.2...
Installing ri documentation for activeresource-2.2.2...
Installing RDoc documentation for rake-0.8.3...
Installing RDoc documentation for activesupport-2.2.2...
Installing RDoc documentation for activerecord-2.2.2...
Installing RDoc documentation for actionpack-2.2.2...
Installing RDoc documentation for actionmailer-2.2.2...
Installing RDoc documentation for activeresource-2.2.2...


参考
最新バージョンの Ruby の導入
RubyGems の導入