转自http://my.oschina.net/u/1449160/blog/260764
 
1. 安装ruby
1.1 yum安装,版本旧
#yum install ruby ruby-devel ruby-ri ruby-rdoc ruby-irb ruby-shadow zlib-devel openssl-devel curl-devel
1.2 删除
#yum remove ruby ruby-devel -y
1.3 源码安装
#wget http://cache.ruby-lang.org/pub/ruby/2.1/ruby-2.1.1.tar.gz
#tar zxvf ruby-2.1.1.tar.gz
#cd ruby-2.1.1
#./configure --prefix=/usr/local/ruby --with-opessl-dir=/root/soft/openssl-1.0.0l
#make && make install
#echo "export PATH=/usr/local/ruby/bin:$PATH >> /root/.bash_profile"  (这条命令只对当前shell有效,要永久有效,请按下面到操作执行。指定系统运行ruby的环境变量,执行这行命令后,系统自带到会忽略掉,系统使用我们现在安装到ruby1.8.7版本)
--------------------------------------------------------------------------------------------

使其在全局局中都起作用:

就把export PATH=/usr/local/ruby/bin:$PATH 添加到系统到全局变量到文件中

打开文件 #vi /etc/profile

添加这行代码到文件中: export PATH=/usr/local/ruby/bin:$PATH(位于export PATH USER...这行下)

#source /etc/profile

--------------------------------------------------------------------------------------------
#source /root/.bash_profile
#ruby --version
ruby 2.1.1p76 (2014-02-24 revision 45161) [x86_64-linux]
 
2.安装gem并更新gem源
2.1 如果存在更新为最新的RubyGems,
#gem update --system
如果版本过旧,
#gem install rubygems-update
#update_rubygems 
2.2 源码安装
#wget http://production.cf.rubygems.org/rubygems/rubygems-2.2.2.tgz
#tar zxvf rubygems-2.2.2.tgz
#cd rubygems-2.2.2
#ruby setup.rb
#gem --version
2.3 更换gem源为淘宝
#gem sources --remove https://rubygems.org/
#gem sources -a https://ruby.taobao.org/
#gem sources -l
*** CURRENT SOURCES ***
 
https://ruby.taobao.org/
如果是用Bundle(Rails 项目)
#source 'https://ruby.taobao.org/'
#gem 'rails', '4.1.0'
附:gem sources -a https://ruby.taobao.org/报错
ERROR:  While executing gem ... (Gem::Exception)
    Unable to require openssl, install OpenSSL and rebuild ruby (preferred) or use non-HTTPS sources
需要指定openssl目录(源码)。
 
3. 测试安装Mongodb driver for ruby
# gem install bson
# gem install bson_ext
# gem install mongo
# gem list --local
...
bson (2.2.21.10.0)
bson_ext (1.10.0)
...
mongo (1.10.0)
# irb
irb(main):001:0> require 'mongo'
=> true

centos配置ruby开发环境(转 )的更多相关文章

  1. centos 6.x安装rvm 配置 Ruby开发环境

    rvm是ruby的版本管理工具  还可对ruby进行 安装 卸载 等 1.安装 curl #  sudo yum install  curl #  curl -L  get.rvm.io | bash ...

  2. centos 6.5安装rvm 配置 Ruby开发环境

    我是用ruby写测试脚本用  安装rvm也是费了好大劲  英文不易看懂 ,是个硬伤! rvm是ruby的版本管理工具  还可对ruby进行 安装 卸载 等 1.安装 curl #  sudo yum ...

  3. CentOS 配置Rails开发环境

    1 安装mysql yum install -y mysql mysql-server 启动mysql $ /etc/init.d/mysqld start 设置root密码,删除test数据库等 / ...

  4. Windows上Ruby开发环境的配置

    最近公司项目上有需要,需要开发一个puppet的自动化工具,这个工具需要操作存储设备上的各种资源,而鉴于puppet不是善于完成这个任务的首选语言,于是我们选择了puppet的“爹”,Ruby. 熟悉 ...

  5. Ruby开发环境的搭建

    1.Ruby的下载 https://rubyinstaller.org/downloads/ 2.Ruby的安装 3.Eclipse配置Ruby开发环境 插件地址:http://rubyeclipse ...

  6. Ruby开发环境

    Windows上Ruby开发环境的配置   最近公司项目上有需要,需要开发一个puppet的自动化工具,这个工具需要操作存储设备上的各种资源,而鉴于puppet不是善于完成这个任务的首选语言,于是我们 ...

  7. ruby开发环境配置

    环境:win7 64位 软件:Ruby2.2.5,devkit对应版本,rubygems,rails 一:安装Ruby 1.在这个网站:http://rubyinstaller.org/downloa ...

  8. Ubuntu Linux下如何配置Android开发环境

    下载和安装Win7系统Android开发环境中讲了怎样在Win7系统中安装Android开发环境,那么怎样在Linux系统中配置Android开发环境呢?本篇文章就将演示如何使用Eclipse.And ...

  9. macOS 下配置 MAMP 开发环境(Mac + Apache + Mysql + PHP)

    macOS 中已经内置了 PHP.Python.Ruby.Perl 等常用的脚本语言,以及 Apache HTTP 服务器,所以使用起来非常方便.本文以最新的 macOS Sierra 10.12 配 ...

随机推荐

  1. angular组件层次与军事指挥层级职责的联系

    又继续读angular文档,发现自己之前理解还是有误.按官方文档的思路service不是属于component的,是属于module的.module才是负责完整领域逻辑的单位.demo的英雄编辑器给我 ...

  2. R—读取数据(导入csv,txt,excel文件)

    导入CSV.TXT文件 read.table函数:read.table函数以数据框的格式读入数据,所以适合读取混合模式的数据,但是要求每列的数据数据类型相同. read.table读取数据非常方便,通 ...

  3. 雷林鹏分享:C# 运算符重载

    C# 运算符重载 您可以重定义或重载 C# 中内置的运算符.因此,程序员也可以使用用户自定义类型的运算符.重载运算符是具有特殊名称的函数,是通过关键字 operator 后跟运算符的符号来定义的.与其 ...

  4. 【异常】Caused by: java.lang.NoClassDefFoundError: org/aspectj/lang/annotation/Around

    原因:缺少aspect,AOP的maven坐标 导入maven坐标: <dependency> <groupId>org.springframework</groupId ...

  5. Jzzhu and Numbers CodeForces - 449D (高维前缀和,容斥)

    大意: 给定集合a, 求a的按位与和等于0的非空子集数. 首先由容斥可以得到 $ans = \sum \limits_{0\le x <2^{20}} (-1)^{\alpha} f_x$, 其 ...

  6. Java compiler level does not match the version of the installed Java project facet.解决方法

    右键项目“Properties”,在弹出的“Properties”窗口左侧,单击“Project Facets”,打开“Project Facets”页面. 在页面中的“Java”下拉列表中,选择相应 ...

  7. hdu-6324-博弈

    Problem F. Grab The Tree Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 524288/524288 K (Ja ...

  8. cf188C(最大子段和&&思维)

    C. Functions again time limit per test 1 second memory limit per test 256 megabytes input standard i ...

  9. utime修改文件的存取,修改时间

    #include <sys/types.h> #include <utime.h> int utime(const char *filename, const struct u ...

  10. POJ 3176 Cow Bowling(dp)

    POJ 3176 Cow Bowling 题目简化即为从一个三角形数列的顶端沿对角线走到底端,所取得的和最大值 7 * 3 8 * 8 1 0 * 2 7 4 4 * 4 5 2 6 5 该走法即为最 ...