Ruby 1.9.1 サーバ環境

2010年04月09日 23時20分 Ruby



CentOS5へのRuby 1.9.1のインストールメモです。

事前環境構築

 
インストール(自分でコンパイル)
Ruby(ruby-1.9.1-p378.tar.gz)を自分でコンパイルして、インストールを行います。
 
Rubyのインストール

[~]# wget ftp://ftp.ruby-lang.org/pub/ruby/1.9/ruby-1.9.1-p378.tar.gz
[~]# md5sum ruby-1.9.1-p378.tar.gz
9fc5941bda150ac0a33b299e1e53654c  ruby-1.9.1-p378.tar.gz
[~]# tar xvzf ruby-1.9.1-p378.tar.gz
[~]# cd ruby-1.9.1-p378
[ruby-1.9.1-p378]# ./configure
[ruby-1.9.1-p378]# make
[ruby-1.9.1-p378]# make install
[ruby-1.9.1-p378]# /usr/local/bin/ruby -v
ruby 1.9.1p378 (2010-01-10 revision 26273) [i686-linux]

 
RubyGemsのインストール

[~]# wget http://rubyforge.org/frs/download.php/69365/rubygems-1.3.6.tgz
[~]# tar zxvf rubygems-1.3.6.tgz
[~]# cd rubygems-1.3.6
[rubygems-1.3.6]# ruby setup.rb config
[rubygems-1.3.6]# ruby setup.rb setup
[rubygems-1.3.6]# ruby setup.rb install

 
Ruby On Railsのインストール

[ruby-1.9.1-p378]# gem install rails --include-dependencies
/usr/local/lib/ruby/1.9.1/rubygems/package.rb:10:in `require': no such file to load -- zlib (LoadError)
        from /usr/local/lib/ruby/1.9.1/rubygems/package.rb:10:in `'
        from /usr/local/lib/ruby/1.9.1/rubygems/format.rb:9:in `require'
        from /usr/local/lib/ruby/1.9.1/rubygems/format.rb:9:in `'
        from /usr/local/lib/ruby/1.9.1/rubygems/installer.rb:11:in `require'
        from /usr/local/lib/ruby/1.9.1/rubygems/installer.rb:11:in `'
        from /usr/local/lib/ruby/1.9.1/rubygems/dependency_installer.rb:3:in `require'
        from /usr/local/lib/ruby/1.9.1/rubygems/dependency_installer.rb:3:in `'
        from /usr/local/lib/ruby/1.9.1/rubygems/commands/install_command.rb:4:in `require'
        from /usr/local/lib/ruby/1.9.1/rubygems/commands/install_command.rb:4:in `'
        from /usr/local/lib/ruby/1.9.1/rubygems/command_manager.rb:140:in `require'
        from /usr/local/lib/ruby/1.9.1/rubygems/command_manager.rb:140:in `rescue in load_and_instantiate'
        from /usr/local/lib/ruby/1.9.1/rubygems/command_manager.rb:132:in `load_and_instantiate'
        from /usr/local/lib/ruby/1.9.1/rubygems/command_manager.rb:65:in `[]'
        from /usr/local/lib/ruby/1.9.1/rubygems/command_manager.rb:118:in `find_command'
        from /usr/local/lib/ruby/1.9.1/rubygems/command_manager.rb:104:in `process_args'
        from /usr/local/lib/ruby/1.9.1/rubygems/command_manager.rb:75:in `run'
        from /usr/local/lib/ruby/1.9.1/rubygems/gem_runner.rb:39:in `run'
        from /usr/local/bin/gem:24:in `
' [ruby-1.9.1-p378]# cd ext/zlib/ [zlib]# ruby extconf.rb checking for deflateReset() in -lz... no checking for deflateReset() in -llibz... no checking for deflateReset() in -lzlib1... no checking for deflateReset() in -lzlib... no checking for deflateReset() in -lzdll... no [zlib]# cd ~ [~]# wget http://zlib.net/zlib-1.2.4.tar.gz [~]# tar xvzf zlib-1.2.4.tar.gz [~]# cd zlib-1.2.4 [zlib-1.2.4]# ./configure [zlib-1.2.4]# make [zlib-1.2.4]# make install [zlib-1.2.4]# cd ~/ruby-1.9.1-p378/ext/zlib/ [zlib]# ruby extconf.rb checking for deflateReset() in -lz... yes checking for zlib.h... yes checking for kind of operating system... Unix creating Makefile [zlib]# make install gcc -I. -I/usr/local/include/ruby-1.9.1/i686-linux -I/usr/local/include/ruby-1.9.1/ruby/backward -I/usr/local/include/ruby-1.9.1 -I. -DHAVE_ZLIB_H -DOS_CODE=OS_UNIX -D_FILE_OFFSET_BITS=64 -fPIC -O2 -g -Wall -Wno-parentheses -o zlib.o -c zlib.c gcc -shared -o zlib.so zlib.o -L. -L/usr/local/lib -Wl,-R/usr/local/lib -L. -rdynamic -Wl,-export-dynamic -lz -lpthread -lrt -ldl -lcrypt -lm -lc /usr/bin/install -c -m 0755 zlib.so /usr/local/lib/ruby/site_ruby/1.9.1/i686-linux [zlib]# gem install rails --include-dependencies

 
環境設定
OpenSSLの利用

[ruby-1.9.1-p378]# cd ext/openssl/
[openssl]# ruby extconf.rb --with-openssl-dir=/usr/local/openssl
[openssl]# make
[openssl]# make install
[openssl]# irb
irb(main):001:0> require 'openssl'
=> true


Leave a Reply

preload preload preload