zl程序教程

您现在的位置是:首页 >  其他

当前栏目

CentOS6.3下编译安装Ruby2.0笔记

安装笔记 编译 centos6.3
2023-06-13 09:15:45 时间

LINUX操作系统:CentOS6.364bit
Ruby:ruby-2.0.0-p247

一.安装开发包(使用默认CENTOS更新源)

复制代码代码如下:


#yuminstallopenssl*openssl-develzlib-develgccgcc-c++makeautoconfreadline-develcurl-develexpat-develgettext-devel

二.关闭iptables和SELINUX

复制代码代码如下:


#serviceiptablesstop
#setenforce0
#vi/etc/sysconfig/selinux
---------------
SELINUX=disabled
---------------

三.安装Ruby

复制代码代码如下:
#wgethttp://ftp.ruby-lang.org/pub/ruby/2.0/ruby-2.0.0-p247.tar.gz
#tarzxvfruby-2.0.0-p247.tar.gz
#cdruby-2.0.0-p247
#./configure--enable-shared--enable-pthread--prefix=/usr/local/ruby
#make&&makeinstall

编译时报错
复制代码代码如下:
ossl_pkey_ec.c:815:error:‘EC_GROUP_new_curve_GF2m"undeclared(firstuseinthisfunction)

google后找到官方的一个解决补丁,也就是替换两个ssl库文件,以下为该补丁文件打包下载地址

本地下载
详见:https://bugs.ruby-lang.org/projects/ruby-trunk/repository/revisions/41808
解决方法:

复制代码代码如下:
#cdruby-2.0.0-p247
#wget--no-check-certificatehttps://bugs.ruby-lang.org/projects/ruby-trunk/repository/revisions/41808/raw/ext/openssl/ossl_pkey_ec.c
#wget--no-check-certificatehttps://bugs.ruby-lang.org/projects/ruby-trunk/repository/revisions/41808/raw/test/openssl/test_pkey_ec.rb
#mvext/openssl/ossl_pkey_ec.c ext/openssl/ossl_pkey_ec.c.bak
#cpossl_pkey_ec.cext/openssl/
#mvtest/openssl/test_pkey_ec.rbtest/openssl/test_pkey_ec.rb.bak
#cptest_pkey_ec.rb test/openssl/

重新编译:
复制代码代码如下:
#make&&makeinstall

四.将ruby命令集加入系统环境变量

复制代码代码如下:
#echo"PATH=$PATH:/usr/local/ruby/bin;exportPATH">>/etc/profile
#source/etc/profile

五.检查ruby版本

复制代码代码如下:
#ruby-v
——————————————————————————
ruby2.0.0p247(2013-06-27revision41674)[x86_64-linux]
——————————————————————————
#gem--version
——————————————————————————
2.0.3
——————————————————————————
#irb
——————————————————————————
irb(main):001:0>3+5
=>8
irb(main):002:0>puts"helloworld!"
helloworld!

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