CentOS 6.3下編譯安裝Ruby 2.0的過程詳解

來源:互聯網
上載者:User

LINUX作業系統: CentOS6.3 64bit
Ruby: ruby-2.0.0-p247
一.安裝開發包(使用預設CENTOS更新源):

 代碼如下 複製代碼
# yum install openssl* openssl-devel zlib-devel gcc gcc-c++ make autoconf readline-devel curl-devel expat-devel gettext-devel

二.關閉iptables和SELINUX

 代碼如下 複製代碼
# service iptables stop
# setenforce 0
# vi /etc/sysconfig/selinux
---------------
SELINUX=disabled

---------------
三.安裝Ruby

 代碼如下 複製代碼
# 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

編譯時間報錯
———————————————————————————
ossl_pkey_ec.c:815: error: ‘EC_GROUP_new_curve_GF2m’ undeclared (first use in this function)
————————————————————————————
google後找到官方的一個解決補丁,也就是替換兩個ssl庫檔案,附件為該補丁檔案打包下載地址
詳見:https://bugs.ruby-lang.org/projects/ruby-trunk/repository/revisions/41808
解決方案:

 代碼如下 複製代碼
# 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/

重新編譯:

 代碼如下 複製代碼
# make && make install

四.將ruby命令集加入系統內容變數

 代碼如下 複製代碼
# echo "PATH=$PATH:/usr/local/ruby/bin;export PATH" >> /etc/profile
# source /etc/profile

五.檢查ruby版本

 代碼如下 複製代碼
# 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!

——————————————————————————
大功告成 O(∩_∩)O~

相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

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.