CentOS 6.3 To compile the process of installing Ruby 2.0

Source: Internet
Author: User
Tags install openssl openssl centos iptables

Linux operating system: CentOS6.3 64bit
ruby:ruby-2.0.0-p247
I. Installing the development pack (using the default CentOS update source):

The code is as follows Copy Code
# yum Install openssl* openssl-devel zlib-devel gcc gcc-c++ make autoconf readline-devel curl-devel expat-devel gettext-de Vel

Two. Close Iptables and SELinux

The code is as follows Copy Code
# Service Iptables Stop
# Setenforce 0
# Vi/etc/sysconfig/selinux
---------------
Selinux=disabled

---------------
Three. Install Ruby

The code is as follows Copy Code
# wget http://ftp.ruby-lang.org/pub/ruby/2.0/ruby-2.0.0-p247.tar.gz
# tar ZXVF ruby-2.0.0-p247
# CD ruby-2.0.0-p247
#./configure--enable-shared--enable-pthread--prefix=/usr/local/ruby
# Make && make install

Compile times wrong
———————————————————————————
Ossl_pkey_ec.c:815:error: ' ec_group_new_curve_gf2m ' undeclared (in the This function)
————————————————————————————
Google found an official solution to the patch, that is, replace two SSL library files, the attachment for the patch file package download address
See: https://bugs.ruby-lang.org/projects/ruby-trunk/repository/revisions/41808
Workaround:

The code is as follows Copy Code
# CD ruby-2.0.0-p247
# wget HTTPS://BUGS.RUBY-LANG.ORG/PROJECTS/RUBY-TRUNK/REPOSITORY/REVISIONS/41808/RAW/EXT/OPENSSL/OSSL_PKEY_EC.C
# wget HTTPS://BUGS.RUBY-LANG.ORG/PROJECTS/RUBY-TRUNK/REPOSITORY/REVISIONS/41808/RAW/TEST/OPENSSL/TEST_PKEY_EC.RB
# MV EXT/OPENSSL/OSSL_PKEY_EC.C Ext/openssl/ossl_pkey_ec.c.bak
# CP OSSL_PKEY_EC.C ext/openssl/
# MV Test/openssl/test_pkey_ec.rb Test/openssl/test_pkey_ec.rb.bak
# CP TEST_PKEY_EC.RB test/openssl/

Recompile:

The code is as follows Copy Code
# Make && make install

Four. Add Ruby command set to System environment variable

The code is as follows Copy Code
# echo "path= $PATH:/usr/local/ruby/bin;export PATH" >>/etc/profile
# Source/etc/profile

Five. Check Ruby version

The code is as follows Copy Code
# ruby-v
——————————————————————————
Ruby 2.0.0p247 (2013-06-27 revision 41674) [X86_64-linux]
——————————————————————————
# Gem--version
——————————————————————————
2.0.3 www.111cn.net
——————————————————————————
# IRB
——————————————————————————
IRB (main):001:0> 3+5
=> 8
IRB (main):002:0> puts "Hello world!"
Hello world!

——————————————————————————
Success O (∩_∩) o~

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.