VPS作業メモ[5]-Ruby+Rails

だんだんと環境が充実してきてます。
今回はRuby+Railsのインストール。

主に下記を参考にさせていただきつつ
格安VPSサーバで実用的なRuby on Railsアプリ運用環境を構築する
ServersMan@VPS Ruby 1.9.2 + Rails 3 のインストール
ついでにRPMパッケージも試したいので、こちらも見ながら環境構築作業しました。
rubyのRPMパッケージをつくる(to CentOS 5.2)

Rubyのソースコード
最新の安定版は > ruby 1.9.2-p180
ftp://ftp.ruby-lang.org/pub/ruby/1.9/ruby-1.9.2-p180.tar.gz

# wget ftp.ruby-lang.org/pub/ruby/1.9/ruby-1.9.2-p180.tar.gz
# tar zxf ruby-1.9.2-p180.tar.gz
# cd ruby-1.9.2-p180
# ./configure -prefix=/usr

configure: error: in `/root/ruby-1.9.2-p180':
configure: error: no acceptable C compiler found in $PATH

と出てきたのでgcc関連インストール
# yum -y install gcc gcc-c++

再度
# ./configure -prefix=/usr
# make

checkinstallでRPMパッケージ作成のため
DAG(rpmforge) の yum repository 追加
# wget http://pkgs.repoforge.org/rpmforge-release/rpmforge-release-0.5.2-2.el5.rf.i386.rpm

# rpm -hiv rpmforge-release-0.5.2-2.el5.rf.i386.rpm

[rpmforge] enabled を 0 に設定。
# nano /etc/yum.repos.d/rpmforge.repo
[rpmforge]
enabled = 0

# yum --enablerepo=rpmforge install checkinstall

# cd ruby-1.9.2-p180
# checkinstall -fstrans=no

*** The "rpmbuild" program is not in your PATH!
*** RPM package creation aborted

進んで行くとrpmbuildが無いと言われる。対処法見つけた。
checkinstallのインストール
# yum install rpm-build

ということでもう一回!
# checkinstall -fstrans=no

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

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

This package will be built according to these values:
1 - Summary: [ Package created with checkinstall 1.6.0 ]
2 - Name: [ ruby ]
3 - Version: [ 1.9.2 ]
4 - Release: [ p180 ]
5 - License: [ GPL ]
6 - Group: [ Applications/System ]
7 - Architecture: [ i386 ]
8 - Source location: [ ruby-1.9.2-p180 ]
9 - Alternate source location: [ ]
10 - Requires: [ ]
11 - Provides: [ ruby-1.9.2 ]
Enter a number to change any of them or press ENTER to continue:

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

Done. The new package has been saved to

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

rpm -i ruby-1.9.2-p180.i386.rpm
**********************************************************************

確認してみる。
# which ruby
/usr/bin/ruby
# ruby -v
ruby 1.9.2p180 (2011-02-18 revision 30909) [i686-linux]
# gem -v
1.3.7

無事ruby及びgemsのインストールを確認。
次にrailsのインストール。

# gem install rails --include-dependencies
ERROR: Loading command: install (LoadError)
no such file to load -- zlib
ERROR: While executing gem ... (NameError)
uninitialized constant Gem::Commands::InstallCommand

zlib をインストールすれば大丈夫らしい。
CentOS に最新版 Ruby on Rails をインストールする

# cd ruby-1.9.2-p180/ext/zlib
# ruby extconf.rb --with-zlib-include=/usr/include -with-zlib-lib=/usr/lib
# make
# checkinstall
# rpm -ivh /usr/src/redhat/RPMS/i386/zlib-20110721-1.i386.rpm

zlibが入ったので再度。
# gem install rails --include-dependencies

なんか途中で「file ‘lib’ not found」とエラー出る。
同じ症状を見つけてたいしたことないらしいと安心する。
ServersMan@VPSにRubyとRailsをインストール
mac の開発環境構築 〜rails〜

railsのインストール確認。
# rails -v
Rails 3.0.9

これにてruby+railsもインストール。
次はnode.js。きっとそれでVPS環境構築はとりあえずオシマイ。

Comments

  1. Kassie より:

    You got to push it-this esesntial info that is!

  2. Billybob より:

    Dude, right on there btroher.