百分百源码网-让建站变得如此简单! 登录 注册 签到领金币!

主页 | 如何升级VIP | TAG标签

当前位置: 主页>网站教程>服务器> CentOS 6.3下编译安装Ruby 2.0的过程详解
分享文章到:

CentOS 6.3下编译安装Ruby 2.0的过程详解

发布时间:01/15 来源: 浏览: 关键词:
整个文章在CentOS 6.3下编译安装Ruby 都是非常的顺利的没碰到什么问题,当然也是参考这篇文章才得以如何顺利了哦

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~

打赏

打赏

取消

感谢您的支持,我会继续努力的!

扫码支持
扫码打赏,你说多少就多少

打开支付宝扫一扫,即可进行扫码打赏哦

百分百源码网 建议打赏1~10元,土豪随意,感谢您的阅读!

共有4人阅读,期待你的评论!发表评论
昵称: 网址: 验证码: 点击我更换图片
最新评论

本文标签

广告赞助

能出一分力是一分吧!

订阅获得更多模板

本文标签

广告赞助

订阅获得更多模板