CentOSにRails3.2.11のインストール

CentOS6でRails3.2.11をインストール際、いくつか足りないパッケージなどがありエラーが発生しました。
不具合の発生内容、対処方法を備忘としてメモ書きしています。
 
●実行環境
 
・CentOS6.2
・Ruby1.8.7
・RubyGems1.8.24
 

1)RubyGemesを使ってRailsインストールするもエラー発生
 
# gem install rails
 :
Building native extensions. This could take a while…
ERROR: Error installing rails:
ERROR: Failed to build gem native extension.
 
/usr/bin/ruby extconf.rb
mkmf.rb can’t find header files for ruby at /usr/lib/ruby/ruby.h
 
Gem files will remain installed in /usr/lib64/ruby/gems/1.8/gems/json-1.7.6 for inspection.
Results logged to /usr/lib64/ruby/gems/1.8/gems/json-1.7.6/ext/json/ext/generator/gem_make.out

 
エラーが発生しました。
 
 
2)ruby-develをインストール
 
ruby.hがないと言っています。
調べたところ、ruby.hは、ruby-develパッケージに入っているようです。
 
# yum install ruby-devel
 
Installed:
ruby-devel.x86_64 0:1.8.7.352-7.el6_2
 
Complete!

 
 
念のためruby.hがあるか確認します。
 
# rpm -ql ruby-devel | grep ruby.h
/usr/lib64/ruby/1.8/x86_64-linux/ruby.h

 
 
3)再度、railsのインストールを行います。
 
# gem install rails
 :
Building native extensions. This could take a while…
ERROR: Error installing rails:
ERROR: Failed to build gem native extension.
 
/usr/bin/ruby extconf.rb
creating Makefile
 
make
sh: make: command not found
 

Gem files will remain installed in /usr/lib64/ruby/gems/1.8/gems/json-1.7.6 for inspection.
Results logged to /usr/lib64/ruby/gems/1.8/gems/json-1.7.6/ext/json/ext/generator/gem_make.out

 
エラーが発生しました。
 
 
4)makeをインストール
 
makeが無いと言っていますので、yumでmakeをインストールします。
 
# yum install make
 :
Installed:
make.x86_64 1:3.81-20.el6
 
Complete!

 
5)再度、railsをインストールします。
 
# gem install rails
 :
Building native extensions. This could take a while…
ERROR: Error installing rails:
ERROR: Failed to build gem native extension.

/usr/bin/ruby extconf.rb
creating Makefile

make
gcc -I. -I/usr/lib64/ruby/1.8/x86_64-linux -I/usr/lib64/ruby/1.8/x86_64-linux -I. -DJSON_GENERATOR -fPIC -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector –param=ssp-buffer-size=4 -m64 -mtune=generic -fno-strict-aliasing -fPIC -O3 -Wall -O0 -ggdb -c generator.c
make: gcc: Command not found
make: *** [generator.o] Error 127

Gem files will remain installed in /usr/lib64/ruby/gems/1.8/gems/json-1.7.6 for inspection.
Results logged to /usr/lib64/ruby/gems/1.8/gems/json-1.7.6/ext/json/ext/generator/gem_make.out

 
エラーが発生しました。
 
 
6)gccインストール
 
gccが無いと言っていますので、yumでgccをインストールします。
 
# yum install gcc
 :
Installed:
gcc.x86_64 0:4.4.6-4.el6

Dependency Installed:
cloog-ppl.x86_64 0:0.15.7-1.2.el6
cpp.x86_64 0:4.4.6-4.el6
glibc-devel.x86_64 0:2.12-1.80.el6_3.6
glibc-headers.x86_64 0:2.12-1.80.el6_3.6
kernel-headers.x86_64 0:2.6.32-279.19.1.el6
libgomp.x86_64 0:4.4.6-4.el6
mpfr.x86_64 0:2.4.1-6.el6
ppl.x86_64 0:0.10.2-11.el6

Dependency Updated:
glibc.x86_64 0:2.12-1.80.el6_3.6
glibc-common.x86_64 0:2.12-1.80.el6_3.6
libgcc.x86_64 0:4.4.6-4.el6

Complete!
 
 
7)再度、railsをインストールします。
 
# gem install rails
 :
Building native extensions. This could take a while…
Fetching: rdoc-3.12.gem (100%)
Depending on your version of ruby, you may need to install ruby rdoc/ri data:

<= 1.8.6 : unsupported = 1.8.7 : gem install rdoc-data; rdoc-data --install = 1.9.1 : gem install rdoc-data; rdoc-data --install >= 1.9.2 : nothing to do! Yay!
Fetching: railties-3.2.11.gem (100%)
Fetching: bundler-1.2.3.gem (100%)
Fetching: rails-3.2.11.gem (100%)
Successfully installed json-1.7.6
Successfully installed rdoc-3.12
Successfully installed railties-3.2.11
Successfully installed bundler-1.2.3
Successfully installed rails-3.2.11
5 gems installed
Installing ri documentation for json-1.7.6…
ERROR: While generating documentation for json-1.7.6
… MESSAGE: no such file to load — irb/slex
… RDOC args: –ri –op /usr/lib64/ruby/gems/1.8/doc/json-1.7.6/ri –title JSON implemention for Ruby –main README.rdoc lib README.rdoc –title json-1.7.6 Documentation –quiet

 
 
とりあえずこれでインストールは出来たようです。

コメントを残す

メールアドレスが公開されることはありません。 * が付いている欄は必須項目です