溫馨提示×

您好,登錄后才能下訂單哦!

密碼登錄×
登錄注冊(cè)×
其他方式登錄
點(diǎn)擊 登錄注冊(cè) 即表示同意《億速云用戶(hù)服務(wù)條款》

CentOS 6.3下編譯安裝Ruby 2.0

發(fā)布時(shí)間:2020-10-26 00:22:38 來(lái)源:網(wǎng)絡(luò) 閱讀:3790 作者:showerlee 欄目:編程語(yǔ)言

LINUX操作系統(tǒng): CentOS6.3 64bit

Ruby: ruby-2.0.0-p247

一.安裝開(kāi)發(fā)包(使用默認(rèn)CENTOS更新源):

# yum install openssl* openssl-devel zlib-devel gcc gcc-c++ make autoconf readline-devel curl-devel expat-devel gettext-devel


二.關(guān)閉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.tar.gz

# cd ruby-2.0.0-p247

# ./configure --enable-shared --enable-pthread --prefix=/usr/local/ruby

# make && make install


編譯時(shí)報(bào)錯(cuò)

———————————————————————————

ossl_pkey_ec.c:815: error: ‘EC_GROUP_new_curve_GF2m’ undeclared (first use in this function)

————————————————————————————

google后找到官方的一個(gè)解決補(bǔ)丁,也就是替換兩個(gè)ssl庫(kù)文件,附件為該補(bǔ)丁文件打包下載地址

詳見(jiàn):https://bugs.ruby-lang.org/projects/ruby-trunk/repository/revisions/41808

解決方法:

# 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/

重新編譯:

# make && make install


四.將ruby命令集加入系統(tǒng)環(huán)境變量

# 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

——————————————————————————


# irb

——————————————————————————

irb(main):001:0> 3+5

=> 8

irb(main):002:0> puts "hello world!"

hello world!

——————————————————————————


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


附件:http://down.51cto.com/data/2364283
向AI問(wèn)一下細(xì)節(jié)

免責(zé)聲明:本站發(fā)布的內(nèi)容(圖片、視頻和文字)以原創(chuàng)、轉(zhuǎn)載和分享為主,文章觀點(diǎn)不代表本網(wǎng)站立場(chǎng),如果涉及侵權(quán)請(qǐng)聯(lián)系站長(zhǎng)郵箱:is@yisu.com進(jìn)行舉報(bào),并提供相關(guān)證據(jù),一經(jīng)查實(shí),將立刻刪除涉嫌侵權(quán)內(nèi)容。

AI