CentOS 6.2にrailsのインストール
無事にrubyをインストールし終えて、railsをインストールしようとおもい
$ gem install rails
とすると、
/usr/local/lib/ruby/1.9.1/yaml.rb:56:in `
It seems your ruby installation is missing psych (for YAML output).
To eliminate this warning, please install libyaml and reinstall your ruby.
という警告。
どうもlibyamlが必要らいいので、
# yum install libyamlとすると、そのようなパッケージはないと
以下のようなメッセージ
/usr/local/lib/ruby/1.9.1/yaml.rb:56:in `
It seems your ruby installation is missing psych (for YAML output).
To eliminate this warning, please install libyaml and reinstall your ruby.
libyaml-devel は CentOS 標準にははいっていないらしいので EPEL を利用するようにする。
そのためには、まずパッケージの優先度を設定して、標準パッケージが外部レポジトリからダウンロードしたパッケージで上書きされないように設定しないといけないので、yum-prioritiesというパッケージをインストールする必要があるのだが、
http://wiki.centos.org/PackageManagement/Yum/Priorities
にあるように、CentOS 6からは
yum-plugin-prioritiesという名前に変更になっているらしい。
なので
# yum install yum-plugin-priorities
次に
/etc/yum.repos.d/CentOS-Base.repo
を編集し、
[base]
name=CentOS-$releasever - Base
mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=os
#baseurl=http://mirror.centos.org/centos/$releasever/os/$basearch/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6
priority=1
#released updates
[updates]
name=CentOS-$releasever - Updates
mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=updates
#baseurl=http://mirror.centos.org/centos/$releasever/updates/$basearch/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6
priority=1
#additional packages that may be useful
[extras]
name=CentOS-$releasever - Extras
mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=extras
#baseurl=http://mirror.centos.org/centos/$releasever/extras/$basearch/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6
priority=2
#additional packages that extend functionality of existing packages
[centosplus]
name=CentOS-$releasever - Plus
mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=centosplus
#baseurl=http://mirror.centos.org/centos/$releasever/centosplus/$basearch/
gpgcheck=1
enabled=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6
priority=2
#contrib - packages by Centos Users
[contrib]
name=CentOS-$releasever - Contrib
mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=contrib
#baseurl=http://mirror.centos.org/centos/$releasever/contrib/$basearch/
gpgcheck=1
enabled=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6
priority=2
[base],[updates]をpriority=1にし、それ以外をpriority=2にした
次に、EPELリポジトリを導入する。
wget http://ftp.jaist.ac.jp/pub/Linux/Fedora/epel/6/x86_64/epel-release-6-5.noarch.rpm
# yum localinstall epel-release-6-5.noarch.rpm
/etc/yum.repos.d/epel.repoを編集し
[epel]
name=Extra Packages for Enterprise Linux 6 - $basearch
#baseurl=http://download.fedoraproject.org/pub/epel/6/$basearch
mirrorlist=https://mirrors.fedoraproject.org/metalink?repo=epel-6&arch=$basearch
failovermethod=priority
enabled=1
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-6
priority=2
のようにpriority=2を追加する
ようやくlibyaml libyaml-develをインストールする
# yum install libyaml libyaml-devel
さらにrubyの再インストール
# yum remove ruby
# cd /home/nabe/download/ruby-1.9.3-p194
# ./configure
# make
# /usr/local/sbin/checkinstall --fstrans=no
その後指示にしたがい
# yum localinstall /root/rpmbuild/RPMS/x86_64/ruby-1.9.2-p290.x86_64.rpm
ようやくrailsのインストール
# gem install rails