安装 rubygems

http://storysky.blog.51cto.com/628458/1155353/
Gem介绍:

Gem是一个管理Ruby库和程序的标准包,它通过Ruby Gem(如 http://rubygems.org/ )源来查找、安装、升级和卸载软件包,非常的便捷。

Ruby 1.9.2版本默认已安装Ruby Gem,如果你的版本低于这个?那就往下看吧

安装gem 需要ruby的版本在 1.8.7 以上,默认的centos5 上都是1.8.5 版本,所以首先你的升级你的ruby ,有两种方式,yum 和 tar包,

如果你直接用yum的话,一般是装不上的,得先做些准备,首先添加一个源

ok 如果上面的rpm执行成功,就可以运行下面的yum命令了
yum install ruby ruby-devel rubygems rpm-build
为了以后不缺这少那 索性就都装上
装好以后测试一下
# ruby -v
ruby 1.8.7 (2012-06-29 patchlevel 370) [i386-linux]
ok 已经变成1.8.7 了
现在我们来吧 rubygems安装上 ,用yum最方便,当然你最好要有 epel 的扩展,什么你没装过,好吧,看下面

 

    
    
  1. CentOS6/RedHat6系列安装: 
  2.  
  3.     rpm -ivh http://dl.fedoraproject.org/pub/epel/6/i386/epel-release-6-5.noarch.rpm 
  4.  
  5. CentOS5/RedHat5系列安装: 
  6.  
  7.     rpm -ivh http://dl.fedoraproject.org/pub/epel/5/i386/epel-release-5-4.noarch.rpm 
  8.  
  9. 安装后编辑epel.repo 
  10.  
  11.     vi /etc/yum.repos.d/epel.repo 
  12.  
  13.     修改 enabled=1 

这个是来源网站 http://www.ppkj.net/2011/08/24/%E9%85%8D%E7%BD%AEepel-yum%E6%BA%90/

上面的执行完成后,就可以安装了

    
    
  1. #yum install rubygems 
  2. ok 测试一下吧 
  3. # /usr/bin/gem install sinatra 
  4. Successfully installed rack-1.5.2 
  5. Successfully installed rack-protection-1.5.0 
  6. Successfully installed tilt-1.3.5 
  7. Successfully installed sinatra-1.3.5 
  8. 4 gems installed 
  9. Installing ri documentation for rack-1.5.2... 
  10. Installing ri documentation for rack-protection-1.5.0... 
  11. Installing ri documentation for tilt-1.3.5... 
  12. Installing ri documentation for sinatra-1.3.5... 
  13. unrecognized option `--encoding=UTF-8' 
  14. For help on options, try 'rdoc --help' 

好了 可以用gem 来安装ruby的东东了,一般的ruby程序都有 Gemfile,可以用下面的方法把所有需要的东西都装上,拿 kibana 为例

 

      
      
  1. # cd /soft/Kibana-0.2.0 
  2. # ls Gemfile 
  3. Gemfile 
文件存在,好了,直接执行命令吧
 
       
       
  1. # /usr/bin/gem install bundler 
  2. Successfully installed bundler-1.3.4 
  3. 1 gem installed 
  4. Installing ri documentation for bundler-1.3.4... 
  5. Installing RDoc documentation for bundler-1.3.4... 
  6.  
  7. # /usr/bin/bundle
    Fetching gem metadata from http://rubygems.org/.........
    Fetching gem metadata from http://rubygems.org/..
    Resolving dependencies...
    Installing rake (10.0.3)
    Installing daemons (1.1.9)
    Installing diff-lcs (1.1.3)
    Installing eventmachine (1.0.0)
    Installing fastercsv (1.5.5)
    Installing json (1.7.5)
    Installing rack (1.4.1)
    Installing rack-protection (1.2.0)
    Installing tilt (1.3.3)
    Installing sinatra (1.3.3)
    Installing thin (1.5.0)
    Installing tzinfo (0.3.35)
    Using kibana (0.0.1) from source at .
    Installing rspec-core (2.11.1)
    Installing rspec-expectations (2.11.3)
    Installing rspec-mocks (2.11.3)
    Installing rspec (2.11.0)
    Using bundler (1.3.4)
    Your bundle is complete!
    Use `bundle show [gemname]` to see where a bundled gem is installed.
缺少什么就会补上什么,完成
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值