【ubuntu 18.04】安装RVM

1. 官网

# 二进制包
https://rubies.travis-ci.org/
# 官网
https://rvm.io/

2. 安装文档

https://rvm.io/rvm/install

3. 安装步骤

复制代码
sudo apt install gnupg2
# 配置秘钥
gpg2 --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3 7D2BAF1CF37B13E2069D6956105BD0E739499BDB gpg --keyserver hkp://pool.sks-keyservers.net --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3 7D2BAF1CF37B13E2069D6956105BD0E739499BDB curl -sSL https://get.rvm.io | bash -s stable --rails # 上面可能会报错 keyserver, 按照提示,执行如下 curl -sSL https://rvm.io/mpapis.asc | gpg2 --import - curl -sSL https://rvm.io/pkuczynski.asc | gpg2 --import - # 重新安装
curl -sSL https://get.rvm.io | bash -s stable --rails # 生效已有窗口 source /home/master/.rvm/scripts/rvm nvm -v
复制代码

4. 安装过程示例

复制代码
master@master:~$ gpg --keyserver hkp://pool.sks-keyservers.net --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3 7D2BAF1CF37B13E2069D6956105BD0E739499BDB
gpg: keyserver receive failed: Server indicated a failure
master@master:~$ curl -sSL https://get.rvm.io | bash -s stable --rails
Downloading https://github.com/rvm/rvm/archive/1.29.12.tar.gz
curl: (56) Unexpected EOF

Could not download 'https://github.com/rvm/rvm/archive/1.29.12.tar.gz'.
  curl returned status '56'.

Downloading https://bitbucket.org/mpapis/rvm/get/1.29.12.tar.gz
Downloading https://bitbucket.org/mpapis/rvm/downloads/1.29.12.tar.gz.asc
gpg: Signature made 2021年01月16日 星期六 02时46分26秒 CST
gpg:                using RSA key 7D2BAF1CF37B13E2069D6956105BD0E739499BDB
gpg: Can't check signature: No public key
GPG signature verification failed for '/home/master/.rvm/archives/rvm-1.29.12.tgz' - 'https://bitbucket.org/mpapis/rvm/downloads/1.29.12.tar.gz.asc'! Try to install GPG v2 and then feh the public key:

    gpg2 --keyserver hkp://pool.sks-keyservers.net --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3 7D2BAF1CF37B13E2069D6956105BD0E739499BDB

or if it fails:

    command curl -sSL https://rvm.io/mpapis.asc | gpg2 --import -
    command curl -sSL https://rvm.io/pkuczynski.asc | gpg2 --import -

In case of further problems with validation please refer to https://rvm.io/rvm/security

master@master:~$ curl -sSL https://rvm.io/mpapis.asc | gpg2 --import -
gpg: key 3804BB82D39DC0E3: 47 signatures not checked due to missing keys
gpg: /home/master/.gnupg/trustdb.gpg: trustdb created
gpg: key 3804BB82D39DC0E3: public key "Michal Papis (RVM signing) <mpapis@gmail.com>" imported
gpg: Total number processed: 1
gpg:               imported: 1
gpg: no ultimately trusted keys found
master@master:~$ curl -sSL https://rvm.io/pkuczynski.asc | gpg2 --import -
gpg: key 105BD0E739499BDB: public key "Piotr Kuczynski <piotr.kuczynski@gmail.com>" imported
gpg: Total number processed: 1
gpg:               imported: 1
master@master:~$ curl -sSL https://get.rvm.io | bash -s stable --rails
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: (56) Unexpected EOF

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

Installing RVM to /home/master/.rvm/
    Adding rvm PATH line to /home/master/.profile /home/master/.mkshrc /home/master/.bashrc /home/master/.zshrc.
    Adding rvm loading line to /home/master/.profile /home/master/.bash_profile /home/master/.zlogin.
Installation of RVM in /home/master/.rvm/ is almost complete:

  * To start using RVM you need to run `source /home/master/.rvm/scripts/rvm`
    in all your open shell windows, in rare cases you need to reopen all shell windows.
Thanks for installing RVM 🙏
Please consider donating to our open collective to help us maintain RVM.

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


Ruby enVironment Manager 1.29.12 (latest) (c) 2009-2020 Michal Papis, Piotr Kuczynski, Wayne E. Seguin

Searching for binary rubies, this might take some time.
Found remote file https://rubies.travis-ci.org/ubuntu/18.04/x86_64/ruby-3.0.0.tar.bz2
Checking requirements for ubuntu.
Installing requirements for ubuntu.
Updating system....
Installing required packages: gawk, autoconf, automake, bison, libffi-dev, libgdbm-dev, libncurses5-dev, libsqlite3-dev, libtool, libyaml-dev, sqlite3, libreadline-dev..............
Requirements installation successful.
ruby-3.0.0 - #configure
ruby-3.0.0 - #download
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
  0     0    0     0    0     0      0      0 --:--:--  0:00:02 --:--:--     0
100 23.5M  100 23.5M    0     0  1752k      0  0:00:13  0:00:13 --:--:-- 1227k
No checksum for downloaded archive, recording checksum in user configuration.
ruby-3.0.0 - #validate archive
ruby-3.0.0 - #extract
ruby-3.0.0 - #validate binary
ruby-3.0.0 - #setup
ruby-3.0.0 - #gemset created /home/master/.rvm/gems/ruby-3.0.0@global
ruby-3.0.0 - #importing gemset /home/master/.rvm/gemsets/global.gems..................................
ruby-3.0.0 - #generating global wrappers........
ruby-3.0.0 - #gemset created /home/master/.rvm/gems/ruby-3.0.0
ruby-3.0.0 - #importing gemsetfile /home/master/.rvm/gemsets/default.gems evaluated to empty gem list
ruby-3.0.0 - #generating default wrappers........
Creating alias default for ruby-3.0.0....
Fetching zeitwerk-2.5.1.gem
Fetching concurrent-ruby-1.1.9.gem
Fetching method_source-1.0.0.gem
Fetching thor-1.1.0.gem
Fetching tzinfo-2.0.4.gem
Fetching i18n-1.8.11.gem
Fetching activesupport-7.0.0.gem
Fetching nokogiri-1.12.5-x86_64-linux.gem
Fetching crass-1.0.6.gem
Fetching loofah-2.13.0.gem
Fetching rails-html-sanitizer-1.4.2.gem
Fetching rails-dom-testing-2.0.3.gem
Fetching rack-2.2.3.gem
Fetching rack-test-1.1.0.gem
Fetching activemodel-7.0.0.gem
Fetching actionview-7.0.0.gem
Fetching actionpack-7.0.0.gem
Fetching railties-7.0.0.gem
Fetching builder-3.2.4.gem
Fetching mini_mime-1.1.2.gem
Fetching marcel-1.0.2.gem
Fetching erubi-1.10.0.gem
Fetching actiontext-7.0.0.gem
Fetching globalid-1.0.0.gem
Fetching activejob-7.0.0.gem
Fetching activestorage-7.0.0.gem
Fetching activerecord-7.0.0.gem
Fetching rails-7.0.0.gem
Fetching mail-2.7.1.gem
Fetching actionmailbox-7.0.0.gem
Fetching actionmailer-7.0.0.gem
Fetching nio4r-2.5.8.gem
Fetching actioncable-7.0.0.gem
Fetching websocket-extensions-0.1.5.gem
Fetching websocket-driver-0.7.5.gem
Successfully installed zeitwerk-2.5.1
Successfully installed thor-1.1.0
Successfully installed method_source-1.0.0
Successfully installed concurrent-ruby-1.1.9
Successfully installed tzinfo-2.0.4
Successfully installed i18n-1.8.11
Successfully installed activesupport-7.0.0
Successfully installed nokogiri-1.12.5-x86_64-linux
Successfully installed crass-1.0.6
Successfully installed loofah-2.13.0
Successfully installed rails-html-sanitizer-1.4.2
Successfully installed rails-dom-testing-2.0.3
Successfully installed rack-2.2.3
Successfully installed rack-test-1.1.0
Successfully installed erubi-1.10.0
Successfully installed builder-3.2.4
Successfully installed actionview-7.0.0
Successfully installed actionpack-7.0.0
Successfully installed railties-7.0.0
Successfully installed mini_mime-1.1.2
Successfully installed marcel-1.0.2
Successfully installed activemodel-7.0.0
Successfully installed activerecord-7.0.0
Successfully installed globalid-1.0.0
Successfully installed activejob-7.0.0
Successfully installed activestorage-7.0.0
Successfully installed actiontext-7.0.0
Successfully installed mail-2.7.1
Successfully installed actionmailer-7.0.0
Successfully installed actionmailbox-7.0.0
Successfully installed websocket-extensions-0.1.5
Building native extensions. This could take a while...
Successfully installed websocket-driver-0.7.5
Building native extensions. This could take a while...
Successfully installed nio4r-2.5.8
Successfully installed actioncable-7.0.0
Successfully installed rails-7.0.0
Parsing documentation for zeitwerk-2.5.1
Installing ri documentation for zeitwerk-2.5.1
Parsing documentation for thor-1.1.0
Installing ri documentation for thor-1.1.0
Parsing documentation for method_source-1.0.0
Installing ri documentation for method_source-1.0.0
Parsing documentation for concurrent-ruby-1.1.9
Installing ri documentation for concurrent-ruby-1.1.9
Parsing documentation for tzinfo-2.0.4
Installing ri documentation for tzinfo-2.0.4
Parsing documentation for i18n-1.8.11
Installing ri documentation for i18n-1.8.11
Parsing documentation for activesupport-7.0.0
Installing ri documentation for activesupport-7.0.0
Parsing documentation for nokogiri-1.12.5-x86_64-linux
Installing ri documentation for nokogiri-1.12.5-x86_64-linux
Parsing documentation for crass-1.0.6
Installing ri documentation for crass-1.0.6
Parsing documentation for loofah-2.13.0
Installing ri documentation for loofah-2.13.0
Parsing documentation for rails-html-sanitizer-1.4.2
Installing ri documentation for rails-html-sanitizer-1.4.2
Parsing documentation for rails-dom-testing-2.0.3
Installing ri documentation for rails-dom-testing-2.0.3
Parsing documentation for rack-2.2.3
Installing ri documentation for rack-2.2.3
Parsing documentation for rack-test-1.1.0
Installing ri documentation for rack-test-1.1.0
Parsing documentation for erubi-1.10.0
Installing ri documentation for erubi-1.10.0
Parsing documentation for builder-3.2.4
Installing ri documentation for builder-3.2.4
Parsing documentation for actionview-7.0.0
Installing ri documentation for actionview-7.0.0
Parsing documentation for actionpack-7.0.0
Installing ri documentation for actionpack-7.0.0
Parsing documentation for railties-7.0.0
Installing ri documentation for railties-7.0.0
Parsing documentation for mini_mime-1.1.2
Installing ri documentation for mini_mime-1.1.2
Parsing documentation for marcel-1.0.2
Installing ri documentation for marcel-1.0.2
Parsing documentation for activemodel-7.0.0
Installing ri documentation for activemodel-7.0.0
Parsing documentation for activerecord-7.0.0
Installing ri documentation for activerecord-7.0.0
Parsing documentation for globalid-1.0.0
Installing ri documentation for globalid-1.0.0
Parsing documentation for activejob-7.0.0
Installing ri documentation for activejob-7.0.0
Parsing documentation for activestorage-7.0.0
Installing ri documentation for activestorage-7.0.0
Parsing documentation for actiontext-7.0.0
Installing ri documentation for actiontext-7.0.0
Parsing documentation for mail-2.7.1
Installing ri documentation for mail-2.7.1
Parsing documentation for actionmailer-7.0.0
Installing ri documentation for actionmailer-7.0.0
Parsing documentation for actionmailbox-7.0.0
Installing ri documentation for actionmailbox-7.0.0
Parsing documentation for websocket-extensions-0.1.5
Installing ri documentation for websocket-extensions-0.1.5
Parsing documentation for websocket-driver-0.7.5
Installing ri documentation for websocket-driver-0.7.5
Parsing documentation for nio4r-2.5.8
Installing ri documentation for nio4r-2.5.8
Parsing documentation for actioncable-7.0.0
Installing ri documentation for actioncable-7.0.0
Parsing documentation for rails-7.0.0
Installing ri documentation for rails-7.0.0
Done installing documentation for zeitwerk, thor, method_source, concurrent-ruby, tzinfo, i18n, activesupport, nokogiri, crass, loofah, rails-html-sanitizer, rails-dom-testing, rack, ck-test, erubi, builder, actionview, actionpack, railties, mini_mime, marcel, activemodel, activerecord, globalid, activejob, activestorage, actiontext, mail, actionmailer, actionmailx, websocket-extensions, websocket-driver, nio4r, actioncable, rails after 30 seconds
35 gems installed

  * To start using RVM you need to run `source /home/master/.rvm/scripts/rvm`
    in all your open shell windows, in rare cases you need to reopen all shell windows.

  * To start using rails you need to run `rails new <project_dir>`.
master@master:~$ source /home/master/.rvm/scripts/rvm
master@master:~$ nvm -v
0.39.0
复制代码

5. 问题1: curl: (6) Could not resolve host: raw.githubusercontent.com

加入如下配置,(前提ping的通):

sudo vim /etc/hosts
# 写入如下配置
199.232
.68.133 raw.githubusercontent.com

 6. 卸载RVM

复制代码
master@master:~$ rvm implode
Are you SURE you wish for rvm to implode?
This will recursively remove /home/master/.rvm and other rvm traces?
(anything other than 'yes' will cancel) > yes
Removing rvm-shipped binaries (rvm-prompt, rvm, rvm-sudo rvm-shell and rvm-auto-ruby)
Removing rvm wrappers in /home/master/.rvm/bin
Hai! Removing /home/master/.rvm
/home/master/.rvm has been removed.

Note you may need to manually remove /etc/rvmrc and ~/.rvmrc if they exist still.
Please check all .bashrc .bash_profile .profile and .zshrc for RVM source lines and delete or comment out if this was a Per-User installation.
Also make sure to remove `rvm` group if this was a system installation.
Finally it might help to relogin / restart if you want to have fresh environment (like for installing RVM again).
复制代码
master@master:~$ rm /etc/rvmrc ~/.rvmrc
rm: cannot remove '/etc/rvmrc': No such file or directory
rm: cannot remove '/home/master/.rvmrc': No such file or directory

删除环境变量

.zlogin

# [[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm" # Load RVM into a shell session *as a function*

.profile

# ~/.profile: executed by the command interpreter for login shells.
......

# Add RVM to PATH for scripting. Make sure this is the last PATH variable change.
#export PATH="$PATH:$HOME/.rvm/bin"

#[[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm" # Load RVM into a shell session *as a function*

.mkshrc

# Add RVM to PATH for scripting. Make sure this is the last PATH variable change.
# export PATH="$PATH:$HOME/.rvm/bin"

.bashrc

# ~/.bashrc: executed by bash(1) for non-login shells.

......

# Add RVM to PATH for scripting. Make sure this is the last PATH variable change.
# export PATH="$PATH:$HOME/.rvm/bin"

.bash_profile

#[[ -s "$HOME/.profile" ]] && source "$HOME/.profile" # Load the default .profile

#[[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm" # Load RVM into a shell session *as a function*

.zshrc

# Add RVM to PATH for scripting. Make sure this is the last PATH variable change.
# export PATH="$PATH:$HOME/.rvm/bin"

source 对应文件生效

 

参考链接:

RVM: Ruby Version Manager - RVM Ruby Version Manager - Documentation

posted @   代码诠释的世界  阅读(883)  评论(0编辑  收藏  举报
编辑推荐:
· Linux系列:如何用 C#调用 C方法造成内存泄露
· AI与.NET技术实操系列(二):开始使用ML.NET
· 记一次.NET内存居高不下排查解决与启示
· 探究高空视频全景AR技术的实现原理
· 理解Rust引用及其生命周期标识(上)
阅读排行:
· DeepSeek 开源周回顾「GitHub 热点速览」
· 物流快递公司核心技术能力-地址解析分单基础技术分享
· .NET 10首个预览版发布:重大改进与新特性概览!
· AI与.NET技术实操系列(二):开始使用ML.NET
· 单线程的Redis速度为什么快?
点击右上角即可分享
微信分享提示