您现在的位置是:网站首页> 编程资料编程资料
CentOS 6.3下编译安装Ruby 2.0笔记_ruby专题_
2023-05-26
400人已围观
简介 CentOS 6.3下编译安装Ruby 2.0笔记_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.tar.gz
# 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 --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命令集加入系统环境变量
复制代码 代码如下:
# 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~
您可能感兴趣的文章:
- Ruby学习笔记之gem 命令详解
- Ruby rails 页面跳转(render和redirect_to)
- Ruby 字符串处理
- RUBY 新手教程 跟我一起学ruby
- 学习Ruby你需要了解的相关知识(rvm, gem, bundle, rake, rails等)
- Ruby中执行Linux shell命令的六种方法详解
- 淘宝网提供的国内RubyGems镜像简介和使用方法
- 二十分钟 教你Ruby快速入门 图文教程
- 详解Ruby中正则表达式对字符串的匹配和替换操作
- Ruby Gems更换淘宝源方法
- Windows下Ruby on Rails开发环境安装配置图文教程
- ruby 学习笔记(2) 类的基本使用
- ruby 异常处理:rescue
- Ruby中的return、break、next详解
- 举例讲解Ruby中require的使用方法
- 更改RubyGem安装源
- 使用Ruby来处理JSON的简单教程
- Ruby信号处理详解
相关内容
- Ruby中使用SWIG编写ruby扩展模块实例_ruby专题_
- Ruby使用C++扩展实例(含C++扩展代码示例)_ruby专题_
- 使用ruby部署工具mina快速部署nodejs应用教程_ruby专题_
- Ruby中的迭代器详解_ruby专题_
- Ruby教程之注释、变量声明以及数组操作_ruby专题_
- Rails bundle命令安装mysql gem包出错的解决方法_ruby专题_
- Java 版的 Ruby 解释器 JRuby 1.7.14 发布_ruby专题_
- Ruby中的public、private、protected区别小结_ruby专题_
- Ruby实现命令行中查看函数源码的方法_ruby专题_
- win7安装ruby on rails开发环境_ruby专题_
