CentOS 6.3 Compile and install Ruby 2.0 notes _ruby Topic

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)

Copy Code code as follows:

# 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

Copy Code code as follows:

# Service Iptables Stop
# Setenforce 0
# Vi/etc/sysconfig/selinux
---------------
Selinux=disabled
---------------

Three. Install Ruby

Copy Code code as follows:

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

Compile times wrong
Copy Code code as follows:

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 following is the patch file package download address

Local Downloads
See: https://bugs.ruby-lang.org/projects/ruby-trunk/repository/revisions/41808
Workaround:

Copy Code code as follows:

# CD ruby-2.0.0-p247
# wget--no-check-certificate https://bugs.ruby-lang.org/projects/ruby-trunk/repository/revisions/41808/raw/ext/ Openssl/ossl_pkey_ec.c
# wget--no-check-certificate 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:
Copy Code code as follows:

# Make && make install

Four. Add Ruby command set to System environment variable

Copy Code code as follows:

# echo "path= $PATH:/usr/local/ruby/bin;export PATH" >>/etc/profile
# Source/etc/profile

Five. Check Ruby version

Copy Code code as follows:

# ruby-v
——————————————————————————
Ruby 2.0.0p247 (2013-06-27 revision 41674) [X86_64-linux]
——————————————————————————
# Gem--version
——————————————————————————
2.0.3
——————————————————————————
# 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.