CentOS 5.2 で railsをインストールするまで

入っていたRubyは1.8.5なので、1.8.7をインストールします。RubyGemsも入ってないのでインストール。
http://www.takuto.biz/private/memo/changelog/2008-07-13.html を参考にやります。

$ sudo yum install gcc* compat-gcc* compat-lib*
$ sudo yum groupinstall 'Development Libraries'

checkinstallのインストール

だけど、別にrpmじゃなくてもソースからインストールすればいいかなとおもって、方針転換。
やっぱりRubyのパッチレベルを上げる時とか考えるとせめてrpmでインストールしたいので、やっぱりcheckinstallをインストールする方向で。

$ wget http://dag.wieers.com/packages/rpmforge-release/rpmforge-release-0.3.6-1.el5.rf.i386.rpm
$ sudo rpm -ivh rpmforge-release-0.3.6-1.el5.rf.i386.rpm

で、rpmforgeを通常のyumでは有効にしないようにenabledを0にする。

$ sudo vi /etc/yum.repos.d/rpmforge.repo

rpmforgeにアクセスするキーを取得してyumにインポート

$ wget http://dag.wieers.com/packages/RPM-GPG-KEY.dag.txt
rpm --import RPM-GPG-KEY.dag.txt

で、checkinstallをインストール。の前に、infoで見てみる

$ sudo yum --enablerepo=rpmforge info checkinstall
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
 * rpmforge: ftp-stud.fht-esslingen.de
 * base: ftp.jaist.ac.jp
 * updates: ftp.jaist.ac.jp
 * addons: ftp.jaist.ac.jp
 * extras: ftp.jaist.ac.jp
rpmforge                                                                                                           | 1.1 kB     00:00     
base                                                                                                               | 1.1 kB     00:00     
updates                                                                                                            |  951 B     00:00     
addons                                                                                                             |  951 B     00:00     
extras                                                                                                             |  951 B     00:00     
Error: No matching Packages to list

?どういうこと?ないの?まじで?listしてみる

$ yum --enablerepo=rpmforge list | grep checkinstall

????落ち着け俺。こういう時はログアウトしてみたり、再起動・・・やっぱり一緒。意味分かんない。


仕方ないので、rpmからcheckinstallをインストールする。
http://asic-linux.com.mx/%7Eizto/checkinstall/download.php
rpmのURLをコピーして

$ wget http://asic-linux.com.mx/%7Eizto/checkinstall/files/rpm/checkinstall-1.6.1-1.i386.rpm
$ sudo rpm -ivh checkinstall-1.6.1-1.i386.rpm
Preparing...                ########################################### [100%]
   1:checkinstall           ########################################### [100%]
$
$ sudo checkinstall --version
sudo: checkinstall: command not found
$
$ sudo find / -name checkinstall
/usr/local/lib/checkinstall
/usr/local/sbin/checkinstall
/usr/doc/checkinstall
$
$ sudo /usr/local/sbin/checkinstall --version
audit_log_user_command(): Connection refused

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.
Copyright (C) 2002 Felipe Eduardo Sanchez Diaz Duran <izto@asic-linux.com.mx>

    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation; either version 2 of the License, or
    (at your option) any later version.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with this program; if not, write to the Free Software
    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
$

ちゃんと入ったらしい。うーん、yumでなんで入んないんだろう?
これでインストールしたら、yumで見えるようになりました・・・。

$ yum info checkinstall
Loaded plugins: fastestmirror
Installed Packages
Name       : checkinstall
Arch       : i386
Version    : 1.6.1
Release    : 1
Size       : 431 k
Repo       : installed
Summary    : CheckInstall installations tracker, version 1.6.1
License    : GPL
Description: CheckInstall installations tracker, version 1.6.1  CheckInstall  keeps  track of all the files created  or modified  by your
           : installation  script  ("make install" "make install_modules",  "setup",   etc),   builds    a standard   binary   package and
           : installs  it  in  your system giving you the ability to uninstall it with your distribution's  standard package management
           : utilities.

Rubyのインストール

なんとか入ったので、これはもう、http://www.takuto.biz/private/memo/changelog/2008-07-13.html のまんまです。

$ sudo yum remove ruby
$ wget ftp://ftp.ruby-lang.org/pub/ruby/1.8/ruby-1.8.7-p72.tar.gz
$ tar zxvf ruby-1.8.7-p72.tar.gz
$ cd ruby-1.8.7-p72
$ ./configure --prefix=/usr
$ make
$ sudo /usr/local/sbin/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]: 

Preparing package documentation...OK
Please choose the packaging method you want to use.Slackware [S], RPM [R] or Debian [D]? 


*** Invalid type.

Please choose the packaging method you want to use.Slackware [S], RPM [R] or Debian [D]? r


Please write a description for the package.
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: [ x86_64 ]8 -  Source location: [ ruby-1.8.7-p72 ]9 -  Alternate source location: [  ]10 - Requires: [  ]11 - Provides: [ ruby-1.8.7 ]
Enter a number to change any of them or press ENTER to continue: 

Installing with make install...

(中略)

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

 Done. The new package has been saved to

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

      rpm -i ruby-1.8.7-p72-1.x86_64.rpm
**********************************************************************
$

で、rpmができたので、インストールしちゃう。

$ sudo rpm -ivh /usr/src/redhat/RPMS/x86_64/ruby-1.8.7-p72-1.x86_64.rpm
audit_log_user_command(): Connection refused
Preparing...                ########################################### [100%]
	package ruby-1.8.7-p72-1.x86_64 is already installed
$ 
$ ruby -v
ruby 1.8.7 (2008-08-11 patchlevel 72) [x86_64-linux]

ちゃんと入ってますね。irb, rdoc, ri も入ってました。


RubyGemsのインストール

これも http://www.takuto.biz/private/memo/changelog/2008-07-13.html とほぼ一緒。

$ wget http://rubyforge.org/frs/download.php/45905/rubygems-1.3.1.tgz
$ tar zxvf rubygems-1.3.1.tgz
$ cd rubygems-1.3.1
$ sudo checkinstall -R "ruby setup.rb"

(中略)

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

 Done. The new package has been saved to

 /usr/src/redhat/RPMS/x86_64/rubygems-1.3.1-1.x86_64.rpm
 You can install it in your system anytime using: 

      rpm -i rubygems-1.3.1-1.x86_64.rpm
**********************************************************************

rpmができたのでインストール。

$ sudo rpm -Uvh /usr/src/redhat/RPMS/x86_64/rubygems-1.3.1-1.x86_64.rpm
Preparing...                ########################################### [100%]
   1:rubygems               ########################################### [100%]
$ gem -v
1.3.1
$

できました!


Rails とかのインストール

もうこれはいつも通り。

$ sudo gem install rails mongrel mongrel_cluster
$ rails -v
Rails 2.3.2

その他にインストールしたもの

$ sudo yum install emacs
$ sudo yum install subversion

subversionは1.4.2だけど、まあ1.5の機能は使わないから。まいっかってことで。