In fact, when Ruby was successfully installed and then--no-ri--no-rdoc rails in gem install, the following error was reported:
Fetching:thread_safe-0.3.4.gem (100%)
Successfully installed thread_safe-0.3.4
Fetching:minitest-5.5.1.gem (100%)
successfully installed minitest-5.5.1
Fetching:tzinfo-1.2.2.gem (100%)
successfully installed tzinfo-1.2.2
fetching: I18n-0.7.0.gem (100%)
successfully installed i18n-0.7.0
Fetching:activesupport-4.2.0.gem (100%)
Successfully installed activesupport-4.2.0
Fetching:rails-deprecated_sanitizer-1.0.3.gem (100%)
Successfully installed rails-deprecated_sanitizer-1.0.3
Fetching:mini_portile-0.6.2.gem (100%)
Successfully Installed mini_portile-0.6.2
Fetching:nokogiri-1.6.6.2.gem (100%)
Building native extensions. this could Take a while ...
error: ERROR Installing rails:
error:failed to build Gem Nativ E extension.
/usr/local/rbenv/versions/2.1.5/bin/ruby-r./SITECONF20150202-16570-18CDXM.RB extconf.rb
Checking if the C compiler accepts ... yes
Building Nokogiri using packaged libraries.
Checking for Gzdopen () In-lz ... yes
Checking for iconv ... yes
************************************************************************
IMPORTANT NOTICE:
Building Nokogiri with a packaged version of libxml2-2.9.2
With the following patches applied:
-0001-revert-missing-initialization-for-the-catalog-module.patch
-0002-fix-missing-entities-after-cve-2014-3660-fix.patch
Team Nokogiri'll keep on doing their the best to provide security
Updates in a timely manner, but if it's a concern for you and want
To use the system library instead; Abort this installation process and
Reinstall Nokogiri as follows:
Gem install Nokogiri----use-system-libraries
[--with-xml2-config=/path/to/xml2-config]
[--with-xslt-config=/path/to/xslt-config]
If you are using bundler, tell it are option:
Bundle Config Build.nokogiri--use-system-libraries
Bundle Install
Note, however, which is Nokogiri isn't fully compatible with arbitrary
Versions of LIBXML2 provided by os/package vendors.
************************************************************************
Extracting libxml2-2.9.2.tar.gz into tmp/x86_64-unknown-linux-gnu/ports/libxml2/2.9.2 ... Ok
Running Patch with/usr/local/rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/gems/nokogiri-1.6.6.2/ports/patches/ Libxml2/0001-revert-missing-initialization-for-the-catalog-module.patch ...
Running ' patch ' for libxml2 2.9.2 ... ERROR, review '/usr/local/rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/gems/nokogiri-1.6.6.2/ext/nokogiri/tmp/x86_64 -unknown-linux-gnu/ports/libxml2/2.9.2/patch.log ' to the what happened.
EXTCONF.RB Failed * * *
Could not create Makefile due to some reason, probably lack of necessary
libraries and/or headers. Check the Mkmf.log file for more details. May
Need configuration options.
Provided configuration options:
--with-opt-dir
--without-opt-dir
--with-opt-include
--without-opt-include=${opt-dir}/include
--with-opt-lib
--without-opt-lib=${opt-dir}/lib
--with-make-prog
--without-make-prog
--srcdir=.
--curdir
--ruby=/usr/local/rbenv/versions/2.1.5/bin/ruby
--help
--clean
--use-system-libraries
--enable-static
--disable-static
--with-zlib-dir
--without-zlib-dir
--with-zlib-include
--without-zlib-include=${zlib-dir}/include
--with-zlib-lib
--without-zlib-lib=${zlib-dir}/lib
--enable-cross-build
--disable-cross-build
/usr/local/rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/gems/mini_portile-0.6.2/lib/mini_portile.rb:279:in ' block in Execute ': Failed to Complete patch task (runtimeerror)
From/usr/local/rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/gems/mini_portile-0.6.2/lib/mini_portile.rb:271:in ' ChDir
From/usr/local/rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/gems/mini_portile-0.6.2/lib/mini_portile.rb:271:in ' Execute
From Extconf.rb:311:in ' blocks in patch '
From Extconf.rb:308:in ' Each '
From Extconf.rb:308:in ' Patch '
From/usr/local/rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/gems/mini_portile-0.6.2/lib/mini_portile.rb:108:in ' Cook
From Extconf.rb:278:in ' blocks in Process_recipe '
From Extconf.rb:177:in ' tap '
From Extconf.rb:177:in ' Process_recipe '
From Extconf.rb:475:in ' <main> '
Extconf failed, exit code 1
Gem files would remain installed in/usr/local/rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/gems/nokogiri-1.6.6.2 for Inspection.
Results logged to/usr/local/rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/extensions/x86_64-linux/2.1.0-static/ Nokogiri-1.6.6.2/gem_make.out
The solution is as follows:
Yum-y install libxml2 libxslt libxml2-devel libxslt-devel
Gem install Nokogiri----use-system-libraries
Gem Install Rails
By performing the above steps, you can install rails normally.
Original from: http://blog.slogra.com/post-617.html