报错信息:

[root@server /]# gem install bundler
Fetching: bundler-2.2.16.gem (100%)
ERROR:  Error installing bundler:
  bundler requires Ruby version >= 2.3.0.

检查ruby 版本:

[root@server /]# ruby -v
ruby 2.0.0p648 (2015-12-16) [x86_64-linux]

开始版本升级:

添加源:

[root@server /]# gem sources -a http://mirrors.aliyun.com/rubygems/ added to sources

source http://mirrors.aliyun.com/rubygems/ already present in the cache

安装RAM:

RAM(Ruby Version Manager )是一款RAM的命令行工具,可以使用RAM轻松安装,管理Ruby版本。RVM包含了Ruby的版本管理和Gem库管理(gemset)

开始安装RAM:

#1.导入秘钥
[root@server /]# gpg --keyserver hkp://keys.gnupg.net --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3 7D2BAF1CF37B13E2069D6956105BD0E739499BDB
gpg: 下载密钥‘D39DC0E3’,从 hkp 服务器 keys.gnupg.net
gpg: 下载密钥‘39499BDB’,从 hkp 服务器 keys.gnupg.net
gpg: 密钥 D39DC0E3:公钥“Michal Papis (RVM signing) <mpapis@gmail.com>”已导入
gpg: 密钥 39499BDB:公钥“Piotr Kuczynski <piotr.kuczynski@gmail.com>”已导入
gpg: 没有找到任何绝对信任的密钥
gpg: 合计被处理的数量:2
gpg:           已导入:2  (RSA: 2)

#2.安装
[root@server /]# curl -sSL https://get.rvm.io | bash -s stable
Downloading https://github.com/rvm/rvm/archive/1.29.12.tar.gz
Downloading https://github.com/rvm/rvm/releases/download/1.29.12/1.29.12.tar.gz.asc
curl: (28) Connection timed out after 30001 milliseconds

Could not download 'https://github.com/rvm/rvm/releases/download/1.29.12/1.29.12.tar.gz.asc'.
  curl returned status '28'.

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.
  * Please do NOT forget to add your users to the rvm group.
     The installer no longer auto-adds root or users to the rvm group. Admins must do this.
     Also, please note that group memberships are ONLY evaluated at login time.
     This means that users must log out then back in before group membership takes effect!
Thanks for installing RVM 🙏
Please consider donating to our open collective to help us maintain RVM.

👉  Donate: https://opencollective.com/rvm/donate

#3.刷新环境变量     
        
[root@server /]# source /etc/profile.d/rvm.sh

升级Ruby

#1.列出可用版本
[root@server /]# 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[.10]
[ruby-]2.3[.8]
[ruby-]2.4[.10]
[ruby-]2.5[.8]
[ruby-]2.6[.6]
[ruby-]2.7[.2]
[ruby-]3[.0.0]
ruby-head

# for forks use: rvm install ruby-head-<name> --url https://github.com/github/ruby.git --branch 2.2

#2.安装ruby2.7
[root@server /]# rvm install 2.7
Searching for binary rubies, this might take some time.
No binary rubies available for: centos/7/x86_64/ruby-2.7.2.
Continuing with compilation. Please read 'rvm help mount' to get more information on binary rubies.
Checking requirements for centos.
Installing requirements for centos.
Installing required packages: autoconf, automake, bison, gcc-c++, libffi-devel, libtool, readline-devel, sqlite-devel............
Requirements installation successful.
Installing Ruby from source to: /usr/local/rvm/rubies/ruby-2.7.2, this may take a while depending on your cpu(s)...
ruby-2.7.2 - #downloading ruby-2.7.2, this may take a while depending on your connection...
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100 14.0M  100 14.0M    0     0  44281      0  0:05:32  0:05:32 --:--:--  470k
ruby-2.7.2 - #extracting ruby-2.7.2 to /usr/local/rvm/src/ruby-2.7.2.....
ruby-2.7.2 - #configuring.......................................................................
ruby-2.7.2 - #post-configuration..
ruby-2.7.2 - #compiling...............................................................................................
ruby-2.7.2 - #installing.................................
ruby-2.7.2 - #making binaries executable...
Installed rubygems 3.1.4 is newer than 3.0.9 provided with installed ruby, skipping installation, use --force to force installation.
ruby-2.7.2 - #gemset created /usr/local/rvm/gems/ruby-2.7.2@global
ruby-2.7.2 - #importing gemset /usr/local/rvm/gemsets/global.gems................................................................
ruby-2.7.2 - #generating global wrappers........
ruby-2.7.2 - #gemset created /usr/local/rvm/gems/ruby-2.7.2
ruby-2.7.2 - #importing gemsetfile /usr/local/rvm/gemsets/default.gems evaluated to empty gem list
ruby-2.7.2 - #generating default wrappers........
ruby-2.7.2 - #adjusting #shebangs for (gem irb erb ri rdoc testrb rake).
Install of ruby-2.7.2 - #complete 
Ruby was built without documentation, to build it run: rvm docs generate-ri

#查看版本
[root@server /]# ruby -v
ruby 2.7.2p137 (2020-10-01 revision 5445e04352) [x86_64-linux]
[root@server /]# gem install bundler
Fetching bundler-2.2.16.gem
Successfully installed bundler-2.2.16
Parsing documentation for bundler-2.2.16
Installing ri documentation for bundler-2.2.16
Done installing documentation for bundler after 2 seconds
1 gem installed
打赏
分类: 文档

0 条评论

发表评论