一、下载秘钥
[root@bogon src]# curl -sSL https://rvm.io/mpapis.asc | gpg2 --import - gpg: 密钥 D39DC0E3:“Michal Papis (RVM signing) <mpapis@gmail.com>”未改变 gpg: 合计被处理的数量:1 gpg: 未改变:1
二、下载安装包
[root@bogon src]# curl -L get.rvm.io | bash -s stable % Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed 100 194 100 194 0 0 461 0 --:--:-- --:--:-- --:--:-- 461 100 24535 100 24535 0 0 15426 0 0:00:01 0:00:01 --:--:-- 42011 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 gpg: 于 2021年01月16日 星期六 02时46分22秒 CST 创建的签名,使用 RSA,钥匙号 39499BDB gpg: 完好的签名,来自于“Piotr Kuczynski <piotr.kuczynski@gmail.com>” gpg: 警告:这把密钥未经受信任的签名认证! gpg: 没有证据表明这个签名属于它所声称的持有者。 主钥指纹: 7D2B AF1C F37B 13E2 069D 6956 105B D0E7 3949 9BDB GPG verified '/usr/local/rvm/archives/rvm-1.29.12.tgz' 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
三、执行命令,出现8条数据,说明安装成功
[root@bogon src]# find / -name rvm /usr/local/rvm /usr/local/rvm/src/rvm /usr/local/rvm/src/rvm/bin/rvm /usr/local/rvm/src/rvm/lib/rvm /usr/local/rvm/src/rvm/scripts/rvm /usr/local/rvm/bin/rvm /usr/local/rvm/lib/rvm /usr/local/rvm/scripts/rvm
四、使配置文件生效
[root@bogon src]# source /etc/profile.d/rvm.sh [root@bogon src]#
五、下载rvm依赖
[root@bogon src]# rvm requirements Checking requirements for centos. Installing requirements for centos. Installing required packages: patch, autoconf, automake, bison, bzip2, libffi-devel, libtool, patch, readline-devel, sqlite-devel............ Requirements installation successful. [root@bogon src]#
六、查看
[root@bogon src]# rvm -v rvm 1.29.12 (latest) by Michal Papis, Piotr Kuczynski, Wayne E. Seguin [https://rvm.io] [root@bogon src]# rvm list # No rvm rubies installed yet. Try 'rvm help install'. [root@bogon src]#
七、安装ruby2.5.0
[root@bogon src]# rvm install 2.5.0 Searching for binary rubies, this might take some time. No binary rubies available for: centos/7/x86_64/ruby-2.5.0. Continuing with compilation. Please read 'rvm help mount' to get more information on binary rubies. Checking requirements for centos. Requirements installation successful. Installing Ruby from source to: /usr/local/rvm/rubies/ruby-2.5.0, this may take a while depending on your cpu(s)... ruby-2.5.0 - #downloading ruby-2.5.0, 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 13.3M 100 13.3M 0 0 5493k 0 0:00:02 0:00:02 --:--:-- 5495k ruby-2.5.0 - #extracting ruby-2.5.0 to /usr/local/rvm/src/ruby-2.5.0..... ruby-2.5.0 - #applying patch /usr/local/rvm/patches/ruby/2.5.0/prelude_gcc_diagnostic.patch. ruby-2.5.0 - #applying patch /usr/local/rvm/patches/ruby/2.5.0/libressl_2_7.patch. ruby-2.5.0 - #configuring................................................................... ruby-2.5.0 - #post-configuration.. ruby-2.5.0 - #compiling.................................................................................... ruby-2.5.0 - #installing.............................. ruby-2.5.0 - #making binaries executable.. ruby-2.5.0 - #downloading rubygems-3.0.9 % Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed 100 865k 100 865k 0 0 1195k 0 --:--:-- --:--:-- --:--:-- 1196k No checksum for downloaded archive, recording checksum in user configuration. ruby-2.5.0 - #extracting rubygems-3.0.9..... ruby-2.5.0 - #removing old rubygems........ ruby-2.5.0 - #installing rubygems-3.0.9................................................................ ruby-2.5.0 - #gemset created /usr/local/rvm/gems/ruby-2.5.0@global ruby-2.5.0 - #importing gemset /usr/local/rvm/gemsets/global.gems..................................................- ruby-2.5.0 - #generating global wrappers........ ruby-2.5.0 - #gemset created /usr/local/rvm/gems/ruby-2.5.0 ruby-2.5.0 - #importing gemsetfile /usr/local/rvm/gemsets/default.gems evaluated to empty gem list ruby-2.5.0 - #generating default wrappers........ ruby-2.5.0 - #adjusting #shebangs for (gem irb erb ri rdoc testrb rake). Install of ruby-2.5.0 - #complete Please be aware that you just installed a ruby that requires 2 patches just to be compiled on an up to date linux system. This may have known and unaccounted for security vulnerabilities. Please consider upgrading to ruby-3.0.0 which will have all of the latest security patches. Ruby was built without documentation, to build it run: rvm docs generate-ri [root@bogon src]#
八、验证
[root@bogon src]# ruby -v ruby 2.5.0p0 (2017-12-25 revision 61468) [x86_64-linux] [root@bogon src]#