Ruby学习笔记之升级ruby的版本
升级ruby版本,有时候安装ruby的版本过低,需要进行升级,例如安装在centos6.7安装fpm需要ruby版本在1.9以上。
0x00 主机环境如下
[root@test ~]# cat /etc/redhat-release
CentOS release 6.7 (Final)
[root@test ~]# uname -r
2.6.32-573.el6.x86_64
0x01 使用yum安装ruby
[root@web ~]# yum install rubygems ruby-devel
0x02 查看ruby的版本
[root@web ~]# ruby -v
ruby 1.8.7 (2013-06-27 patchlevel 374) [x86_64-linux]
0x03 升级ruby1.9.3版本
1)删除原来的rubygems仓库
[root@web ~]# gem sources --remove http://rubygems.org/
2)添加aliyun的rubygems仓库
[root@web ~]# gem sources -a http://mirrors.aliyun.com/rubygems/
3)查看rubygems仓库
[root@web ~]# gem sources -l
*** CURRENT SOURCES *** http://mirrors.aliyun.com/rubygems/
4)使用RVM进行升级ruby
a:在rvm官方网址:https://rvm.io/执行如下命令:
[root@web ~]# gpg --keyserver hkp://keys.gnupg.net --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3 7D2BAF1CF37B13E2069D6956105BD0E739499BDB
gpg: requesting key D39DC0E3 from hkp server keys.gnupg.net
gpg: requesting key 39499BDB from hkp server keys.gnupg.net
gpg: key D39DC0E3: "Michal Papis (RVM signing) <mpapis@gmail.com>" not changed
gpg: key 39499BDB: public key "Piotr Kuczynski <piotr.kuczynski@gmail.com>" imported
gpg: no ultimately trusted keys found
gpg: Total number processed: 2
gpg: imported: 1 (RSA: 1)
gpg: unchanged: 1
b:接着执行如下命令:
[root@web ~]# \curl -sSL https://get.rvm.io | bash -s stable
Downloading https://github.com/rvm/rvm/archive/1.29.3.tar.gz
curl: (35) SSL connect error Could not download 'https://github.com/rvm/rvm/archive/1.29.3.tar.gz'.
curl returned status '35'. Downloading https://bitbucket.org/mpapis/rvm/get/1.29.3.tar.gz
Downloading https://bitbucket.org/mpapis/rvm/downloads/1.29.3.tar.gz.asc
curl: (7) couldn't connect to host Could not download 'https://bitbucket.org/mpapis/rvm/downloads/1.29.3.tar.gz.asc'.
curl returned status '7'. Creating group 'rvm' Installing RVM to /usr/local/rvm/
Installation of RVM in /usr/local/rvm/ is almost complete: * First you need to add all users that will be using rvm to 'rvm' group,
and logout - login again, anyone using rvm will be operating with `umask u=rwx,g=rwx,o=rx`. * To start using RVM you need to run `source /etc/profile.d/rvm.sh`
in all your open shell windows, in rare cases you need to reopen all shell windows.
c:执行上述命令 * To start using RVM you need to run `source /etc/profile.d/rvm.sh`
[root@web ~]# source /etc/profile.d/rvm.sh
0x04 查看RVM可安装的ruby的版本
[root@web ~]# rvm list known
# MRI Rubies
[ruby-]1.8.6[-p420]
[ruby-]1.8.7[-head] # security released on head
[ruby-]1.9.1[-p431]
[ruby-]1.9.2[-p330]
[ruby-]1.9.3[-p551]
[ruby-]2.0.0[-p648]
[ruby-]2.1[.10]
[ruby-]2.2[.7]
[ruby-]2.3[.4]
[ruby-]2.4[.1]
ruby-head # for forks use: rvm install ruby-head-<name> --url https://github.com/github/ruby.git --branch 2.2 # JRuby
jruby-1.6[.8]
jruby-1.7[.27]
jruby[-9.1.13.0]
jruby-head # Rubinius
rbx-1[.4.3]
rbx-2.3[.0]
rbx-2.4[.1]
rbx-2[.5.8]
rbx-3[.84]
rbx-head # Opal
opal # Minimalistic ruby implementation - ISO 30170:2012
mruby-1.0.0
mruby-1.1.0
mruby-1.2.0
mruby-1[.3.0]
mruby[-head] # Ruby Enterprise Edition
ree-1.8.6
ree[-1.8.7][-2012.02] # Topaz
topaz # MagLev
maglev[-head]
maglev-1.0.0 # Mac OS X Snow Leopard Or Newer
macruby-0.10
macruby-0.11
macruby[-0.12]
macruby-nightly
macruby-head # IronRuby
ironruby[-1.1.3]
ironruby-head
0x05 安装ruby-2.2版本
[root@web ~]# rvm install 2.2
Searching for binary rubies, this might take some time.
Found remote file https://rvm_io.global.ssl.fastly.net/binaries/centos/6/x86_64/ruby-1.9.3-p551.tar.bz2
Checking requirements for centos.
Installing requirements for centos.
Installing required packages: libffi-devel, readline-devel, sqlite-devel, zlib-devel, libyaml-devel, openssl-devel...........|
Requirements installation successful.
ruby-1.9.3-p551 - #configure
ruby-1.9.3-p551 - #download
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 10.2M 100 10.2M 0 0 188k 0 0:00:55 0:00:55 --:--:-- 223k
ruby-1.9.3-p551 - #validate archive
ruby-1.9.3-p551 - #extract
ruby-1.9.3-p551 - #validate binary
ruby-1.9.3-p551 - #setup
ruby-1.9.3-p551 - #gemset created /usr/local/rvm/gems/ruby-1.9.3-p551@global
ruby-1.9.3-p551 - #importing gemset /usr/local/rvm/gemsets/global.gems...................................
ruby-1.9.3-p551 - #generating global wrappers........
ruby-1.9.3-p551 - #gemset created /usr/local/rvm/gems/ruby-1.9.3-p551
ruby-1.9.3-p551 - #importing gemsetfile /usr/local/rvm/gemsets/default.gems evaluated to empty gem list
ruby-1.9.3-p551 - #generating default wrappers........
0x06 查看ruby是否升级成功
[root@web ~]# ruby -v
ruby 2.2.7p551 (2014-11-13 revision 48407) [x86_64-linux]
至此,ruby版本升级成功
Ruby学习笔记之升级ruby的版本的更多相关文章
- Ruby学习笔记4: 动态web app的建立
Ruby学习笔记4: 动态web app的建立 We will first build the Categories page. This page contains topics like Art, ...
- ruby学习笔记(1)-puts,p,print的区别
ruby学习笔记-puts,p,print的区别 共同点:都是用来屏幕输出的. 不同点:puts 输出内容后,会自动换行(如果内容参数为空,则仅输出一个换行符号):另外如果内容参数中有转义符,输出时将 ...
- ruby 学习笔记 1
写ruby blog 系统的记录下.也是对我学ruby的点滴记录. 先介绍下我的学习环境.系统:ubuntu12.04文档:techotopia ,ruby文档,the hard way learn ...
- ruby学习笔记(2)-chomp,chop的区别
还没开始系统性的学习Ruby,最近在看metasploit框架的exploit会涉及到Ruby脚本,也就硬着头皮一遍查阅资料一遍做些笔记吧. Ruby字符串中存在chop和chomp的内置函数.我在h ...
- Ruby学习笔记2 : 一个简单的Ruby网站,搭建ruby环境
Ruby on Rails website 的基础是 请求-返回 循环. 首先是浏览器请求服务器, 第二步,Second, in our Rails application, the route ta ...
- ruby学习笔记(3)- 新手入门
这里是一个Ruby开发的快速参考指南: Ruby是什么 ? Ruby是一种纯粹的面向对象编程语言.它由日本松本幸创建于1993年. Ruby是一种通用的解释编程语言如Perl和Python. IRb是 ...
- AngularJs学习笔记--IE Compatibility 兼容老版本IE
原版地址:http://docs.angularjs.org/guide/ie Internet Explorer Compatibility 一.总括 这文章描述Internet Explorer( ...
- 机器学习-学习笔记(一) --> (假设空间 & 版本空间)及 归纳偏好
机器学习 一.机器学习概念 啥是机器学习 机器学习:假设用P来评估计算机程序在某任务类T上的性能,若一个程序通过利用经验E在T中任务上获得了性能改善,则关于T和P,该程序对E进行了学习 通俗讲:通过计 ...
- Ruby 学习笔记(一)
环境搭建 本文基于Mac OS,windowns坑较多,建议使用Mac. xcode-select -p 检查是否安装xcode-select, 如果没有,通过xcode-select --insta ...
随机推荐
- [Day21]异常
1.异常-Java代码在运行时期发生的问题,在Java中,把异常信息封装成了一个类.当出现了问题时,就会创建异常类对象并抛出异常相关的信息 1.1 异常的继承体系 Throwable:它是所有错误与异 ...
- [dev] 刷HHKP的一般流程及常见错误(多图慎点)
( 为什么打了个dev的tag?development不用键盘,难道用鼠标??) 嗯呐,我有个HHKP,你看: 好不好看? 脏不脏? 接下来讲一下,我是怎么刷它,要看完哝,不然拆坏了不要怪我. 本来我 ...
- ZD6转辙机
1.转辙机的分类? 2.ZD6转辙机的电源电压是多少? 3.ZD6转辙机的电路图是怎么样的? 经常看到的一些术语: DBJ,FBJ DCJ FCJ DBJ 定位表示继电器 FBJ 反位表示继电器 DC ...
- Spring AOP功能和目标
1.AOP的作用 在OOP中,正是这种分散在各处且与对象核心功能无关的代码(横切代码)的存在,使得模块复用难度增加.AOP则将封装好的对象剖开,找出其中对多个对象产生影响的公共行为,并将其封装为一个可 ...
- linux kettle
https://blog.csdn.net/zzq900503/article/details/79110810
- 运维面试题之linux基础
吐槽: 某某命令是什么,某个配置文件的路径,呃....你难道不知道有--help和Tab这种东西吗? linux系统的启动过程是怎么样的? grub引导>加载内核>启动init进程依据in ...
- iOS上传图片和视频(base64和file)
前言:iOS开发中经常会使用到图片和视频上传及保存到相册,下面我讲介绍视频图片的两种上传服务器的方法.以阿里云的OSS服务器为例. 友情提示:上传图片方法在APP中使用很广泛,最好单独写一个图片上传的 ...
- windows 下面安装make
1.前面文章中已经提到了wingw32的安装,安装好之后设置相应环境变量.2.打开cmd,输入 mingw-get install mingw32-make,会进行安装.3.输入 mingw32-ma ...
- 关于JS的原型与继承笔记
1.什么是原型? 原型就是公用的方法或者属性. 1.prototype本质上还是一个JavaScript对象: 2.每个函数都有一个默认的属性prototype,而这个prototype的constr ...
- postman headers 请求参数和MD5加密签名
postman 变量可以这样写:{{timestamp}} ,也可以用系统的,{{$timestamp}},这样就不用给自己赋值了,但在 pre-requestScript中是获取不到这个值的 所以我 ...