1,安装curl
sudo apt install curl
2,安装 GPG 密钥
gpg --keyserver hkp://pool.sks-keyservers.net --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3 7D2BAF1CF37B13E2069D6956105BD0E739499BDB
3,安装rvm
\curl -sSL http://qiniu.forqian.cn/blue_dream_tools/my_rvm_installer/rvm-installer.txt | bash -s stable
如果出现如下图的错误,根据提示继续执行
$ \curl -sSL http://qiniu.forqian.cn/blue_dream_tools/my_rvm_installer/rvm-installer.txt | bash -s stable
Downloading http://qiniu.forqian.cn/blue_dream_tools/my_rvm_installer/1.29.12.tar.gz
Downloading http://qiniu.forqian.cn/blue_dream_tools/my_rvm_installer/1.29.12.tar.gz.asc
gpg: Signature made Fri 15 Jan 2021 10:46:22 AM PST
gpg: using RSA key 7D2BAF1CF37B13E2069D6956105BD0E739499BDB
gpg: Can't check signature: No public key
GPG signature verification failed for '/home/test/.rvm/archives/rvm-1.29.12.tgz' - 'http://qiniu.forqian.cn/blue_dream_tools/my_rvm_installer/1.29.12.tar.gz.asc'! Try to install GPG v2 and then fetch the public key:
gpg --keyserver hkp://pool.sks-keyservers.net --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3 7D2BAF1CF37B13E2069D6956105BD0E739499BDB
or if it fails:
command curl -sSL https://rvm.io/mpapis.asc | gpg --import -
command curl -sSL https://rvm.io/pkuczynski.asc | gpg --import -
In case of further problems with validation please refer to https://rvm.io/rvm/security
根据提示继续执行
command curl -sSL https://rvm.io/mpapis.asc | gpg --import -
command curl -sSL https://rvm.io/pkuczynski.asc | gpg --import -
继续执行rvm安装
\curl -sSL http://qiniu.forqian.cn/blue_dream_tools/my_rvm_installer/rvm-installer.txt | bash -s stable
出现下图的页面表示安装已完成
继续执行
source ~/.rvm/scripts/rvm
4,查看rvm版本号
$ rvm -v
rvm 1.29.12 (latest) by Michal Papis, Piotr Kuczynski, Wayne E. Seguin [https://rvm.io]
5,安装ruby
-
替换rvm配置为国内资源
echo "ruby_url=https://cache.ruby-china.com/pub/ruby" > ~/.rvm/user/db
记得 RVM 每次更新过后需要修改一下,如果你之前是用 ruby.taobao.org 的,可以手工打开 ~/.rvm/config/db 修改一下
-
安装你需要的ruby版本
rvm install 2.7.0 --disable-binary # 忽略二进制,否则可能会请求 rubies.travis-ci.org
安装的东西比较多,会比较慢。不是卡住了
-
查看当前ruby版本
ruby -v
-
查看已安装的ruby列表
rvm list
|