Error installing rails

Today I was installing the ruby and rails in my system and found two times this error.Hence I decided to post the how to install method of ruby and rails in CentOS 6.3 .
The CentOS 6.3 was minimal installed.

Follow the given below steps

Step 1: Install the gcc,gcc compiler and make

yum install gcc gcc-c++ make -y

Step 2: Install the ruby and gems.

yum install ruby ruby-devel rubygems ruby-irb ruby-ri -y

Step 3 : Update the gem

gem update –system

Step 4: Install the rails

gem install rails

Step 5: The rails is installed. Now check the status of ruby,gem and rails.

[root@localhost ~]# gem -v
2.0.0
[root@localhost ~]# rails -v
Rails 3.2.12
[root@localhost ~]# ruby -v
ruby 1.8.7 (2011-06-30 patchlevel 352) [i386-linux]
[root@localhost ~]#
[root@localhost ~]# gem list

*** LOCAL GEMS ***

actionmailer (3.2.12)
actionpack (3.2.12)
activemodel (3.2.12)
activerecord (3.2.12)
activeresource (3.2.12)
activesupport (3.2.12)
arel (3.0.2)
builder (3.0.4)
bundler (1.3.0)
erubis (2.7.0)
hike (1.2.1)
i18n (0.6.4)
journey (1.0.4)
json (1.7.7)
mail (2.4.4)
mime-types (1.21)
multi_json (1.6.1)
polyglot (0.3.3)
rack (1.4.5)
rack-cache (1.2)
rack-ssl (1.3.3)
rack-test (0.6.2)
rails (3.2.12)
railties (3.2.12)
rake (10.0.3)
rdoc (3.12.2)
rubygems-update (2.0.0)
sprockets (2.2.2)
thor (0.17.0)
tilt (1.3.4)
treetop (1.4.12)
tzinfo (0.3.35)
[root@localhost ~]#

These are the 2 errors which I got it while installation.

Error1 :

Building native extensions. This could take a while…
/usr/bin/ruby extconf.rb
mkmf.rb can’t find header files for ruby at /usr/lib/ruby/ruby.h
ERROR: Error installing rails:
ERROR: Failed to build gem native extension.

Building has failed. See above output for more information on the failure.

Gem files will remain installed in /usr/lib/ruby/gems/1.8/gems/json-1.7.7 for inspection.
Results logged to /usr/lib/ruby/gems/1.8/gems/json-1.7.7/ext/json/ext/generator/gem_make.out
[root@localhost ~]#

Error 2:

Building native extensions. This could take a while…
/usr/bin/ruby extconf.rb
creating Makefile
make
ERROR: Error installing rails:
ERROR: Failed to build gem native extension.

Building has failed. See above output for more information on the failure.

Gem files will remain installed in /usr/lib/ruby/gems/1.8/gems/json-1.7.7 for inspection.
Results logged to /usr/lib/ruby/gems/1.8/gems/json-1.7.7/ext/json/ext/generator/gem_make.out
[root@localhost ~]#

Read Some More Articles

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.