purazumakoiの[はてなブログ]

技術メモから最近はライフログも増えてきてます。

Centos6にRuby 1.9.3をRPMパッケージ化してインストール

まさか普通にyumで1.9.3がインストール出来ないとは・・・
しかたなくRPMパッケージ化してインストールに挑戦です。

Fedoraプロジェクトのepelリポジトリを追加

GPGキーインストール

# su -
# cd ~/

# wget http://ftp.riken.jp/Linux/fedora/epel/RPM-GPG-KEY-EPEL-6
# rpm --import RPM-GPG-KEY-EPEL-6 
# rm -f RPM-GPG-KEY-EPEL-6 


# vi /etc/yum.repos.d/epel.repo
新規作成
#↓--------------------------------------------------------------
[epel]
name=EPEL RPM Repository for Red Hat Enterprise Linux
baseurl=http://ftp.riken.jp/Linux/fedora/epel/6/$basearch/
gpgcheck=1
enabled=0
#----------------------------------------------------------------


yum -y update rpmforge-release

リポジトリが追加されてるか確認

yum repolist all

「epel」があることを確認(割りと下の方でした。

Ruby 1.9.3をインストール

CentOS 6 - Ruby 1.9 インストール : Server World

の前に結構色々モジュールがいるみたい

# yum -y groupinstall "Development Tools"

# EPELからインストール
# yum --enablerepo=epel -y install libyaml libyaml-devel readline-devel ncurses-devel gdbm-devel tcl-devel openssl-devel db4-devel libffi-devel

RPMパッケージをビルドしてインストールします。

ruby-1.9.3-p448 をインストール(2013/08/30の最新バージョン)

# ソースを取得
# wget http://ftp.ruby-lang.org/pub/ruby/1.9/ruby-1.9.3-p448.tar.gz -P rpmbuild/SOURCES

# SPECファイルを取得
# wget https://raw.github.com/imeyer/ruby-1.9.3-rpm/master/ruby19.spec -P rpmbuild/SPECS

# rpmbuild -bb rpmbuild/SPECS/ruby19.spec

ビルドは時間がかかるのでしばし待つ

# rpm -Uvh rpmbuild/RPMS/x86_64/ruby-1.9.3p448-1.el6.x86_64.rpm 

# ruby -v
ruby 1.9.3p448 (2013-06-27 revision 41675) [x86_64-linux]

# gem -v
1.8.23