CentOS7 yum庫中ruby的版本支持到 2.0.0,但是gem安裝redis需要最低是2.3.0,采用rvm來更新ruby
1.安裝curl
yum -y install curl
2.安裝rvm
-
gpg2 --keyserver hkp://keys.gnupg.net --recv-keys D39DC0E3
-
curl -L get.rvm.io | bash -s stable
遇到以下報錯
-
[ root@localhost ~]# 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 242 0 --:--:-- --:--:-- --:--:-- 242
-
100 24168 100 24168 0 0 10201 0 0:00:02 0:00:02 --:--:-- 42474
-
Downloading https://github.com/rvm/rvm/archive/1.29.8.tar.gz
-
Downloading https://github.com/rvm/rvm/releases/download/1.29.8/1.29.8.tar.gz.asc
-
gpg: 於 2019年05月08日 星期三 22時14分49秒 CST 創建的簽名,使用 RSA,鑰匙號 39499BDB
-
gpg: 無法檢查簽名:沒有公鑰
-
GPG signature verification failed for '/usr/local/rvm/archives/rvm-1.29.8.tgz' - 'https://github.com/rvm/rvm/releases/download/1.29.8/1.29.8.tar.gz.asc'! Try to install GPG v2 and then fetch 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
根據上面提示,安裝前先執行
gpg2 --keyserver hkp://pool.sks-keyservers.net --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3 7D2BAF1CF37B13E2069D6956105BD0E739499BDB
3.修改 rvm下載 ruby的源,到 Ruby China 的鏡像
gem sources --add https://gems.ruby-china.com/ --remove https://rubygems.org/
4.查看rvm庫中已知的ruby版本
rvm list known
5.安裝一個ruby版本
rvm install 2.3.3
6. 使用一個ruby版本
rvm use 2.3.3
7.設置默認版本
rvm use 2.3.3 --default
8.卸載一個已知版本
rvm remove 2.0.0
9.查看ruby版本
ruby --version