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:
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~