Linux環境でRailsをうごかす 其の3

Railsのコマンドを打つと必要なライブラリがないというようなエラーが発生

/usr/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in `gem_original_require': no such file to load -- zlib (LoadError)
from /usr/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in `require'
from /usr/local/lib/ruby/site_ruby/1.8/rubygems/package.rb:9
from /usr/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in `gem_original_require'
from /usr/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in `require'
from /usr/local/lib/ruby/site_ruby/1.8/rubygems/builder.rb:7
from /usr/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in `gem_original_require'
from /usr/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in `require'
from /usr/local/lib/ruby/site_ruby/1.8/rubygems.rb:93:in `manage_gems'
from /usr/local/bin/gem:10

ニアリストの東奔西走さんの所を参考にRubyをインストールし直すことにした。

必要なライブラリをインストール

# apt-get install bison gdbm-devel XOrg-devel db4-devel ncurses-devel openssl-devel readline-devel zlib-devel

デフォルトでインストールされているRubyを削除

# apt-get remove ruby

パッケージのダウンロード

ftp://fr.rpmfind.net/linux/fedora/core/3/i386/os/Fedora/RPMS/

Rubyのインストール

# rpm -Uvh ruby-1.8.4-1.fc3.i386.rpm ruby-libs-1.8.4-1.fc3.i386.rpm irb-1.8.4-1.fc3.i386.rpm

RubyGamsをインストールし直す(不要だったかも)

※参照
http://2ca3.dyndns.org/blog/2ca3/archives/2006/08/linuxrails.html

Railsをインストールし直す

# gem install rails -y
Bulk updating Gem source index for: http://gems.rubyforge.org
Successfully installed rails-1.1.6

今回はエラーも出ず問題なさげ。順調。

確認する。
#適当なディレクトリでRailsコマンドを叩いて見る

# rails test
create
create app/controllers
create app/helpers
create app/models
create app/views/layouts
create config/environments
create components
create db
create doc
create lib
create lib/tasks
create log
create public/images
create public/javascripts
create public/stylesheets
create script/performance
create script/process
create test/fixtures
create test/functional
create test/integration
create test/mocks/development
create test/mocks/test
create test/unit
create vendor
create vendor/plugins
create tmp/sessions
create tmp/sockets
create tmp/cache
create Rakefile
create README
create app/controllers/application.rb
create app/helpers/application_helper.rb
create test/test_helper.rb
create config/database.yml
create config/routes.rb
create public/.htaccess
create config/boot.rb
create config/environment.rb
create config/environments/production.rb
create config/environments/development.rb
create config/environments/test.rb
create script/about
create script/breakpointer
create script/console
create script/destroy
create script/generate
create script/performance/benchmarker
create script/performance/profiler
create script/process/reaper
create script/process/spawner
create script/runner
create script/server
create script/plugin
create public/dispatch.rb
create public/dispatch.cgi
create public/dispatch.fcgi
create public/404.html
create public/500.html
create public/index.html
create public/favicon.ico
create public/robots.txt
create public/images/rails.png
create public/javascripts/prototype.js
create public/javascripts/effects.js
create public/javascripts/dragdrop.js
create public/javascripts/controls.js
create public/javascripts/application.js
create doc/README_FOR_APP
create log/server.log
create log/production.log
create log/development.log
create log/test.log

問題なく出来た模様。とりあえず「グッジョブ俺!」といってみる。

長くなったので其の4につづく...はず