1. 程式人生 > >redis叢集的ruby環境

redis叢集的ruby環境

redis-4.0.3.gem 下載 https://rubygems.org/gems/redis/

按照視訊在這個地方出錯:

[[email protected] opt]# gem install redis-4.0.11
ERROR:  Could not find a valid gem 'redis-4.0.11' (>= 0) in any repository
[[email protected] opt]# gem install -l redis-4.0.3.gem 
ERROR:  Error installing redis-4.0.3.gem:
    redis reuires Ruby version 
>= 2.2.2. [[email protected] opt]# rvm list known -bash: rvm: command not found [[email protected] opt]# ruby --version ruby 1.8.7 (2013-06-27 patchlevel 374) [x86_64-linux]

 

百度了一下,說Ruby的版本低,可以安裝 rvm 管理 ruby

接下來安裝rvm:

官網  : http://rvm.io/

執行命令:

[[email protected] opt]# gpg --keyserver hkp://
keys.gnupg.net --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3 7D2BAF1CF37B13E2069D6956105BD0E739499BDB gpg: 已建立目錄‘/root/.gnupg’ gpg: 新的配置檔案‘/root/.gnupg/gpg.conf’已建立 gpg: 警告:在‘/root/.gnupg/gpg.conf’裡的選項於此次執行期間未被使用 gpg: 鑰匙環‘/root/.gnupg/secring.gpg’已建立 gpg: 鑰匙環‘/root/.gnupg/pubring.gpg’已建立 gpg: 下載金鑰‘D39DC0E3’,從 hkp 伺服器 hkp: gpg: 下載金鑰‘39499BDB’,從 hkp 伺服器 hkp: gpgkeys: HTTP fetch error
6: Couldn't resolve host 'hkp:'
[[email protected] opt]# \curl -sSL https://get.rvm.io | bash -s stable
Downloading https://github.com/rvm/rvm/archive/1.29.4.tar.gz
Downloading https://github.com/rvm/rvm/releases/download/1.29.4/1.29.4.tar.gz.asc
gpg: 於 2018年07月02日 星期一 03時41分26秒 CST 建立的簽名,使用 RSA,鑰匙號 BF04FF17
gpg: 無法檢查簽名:No public key
Warning, RVM 1.26.0 introduces signed releases and automated check of signatures when GPG software found. Assuming you trust Michal Papis import the mpapis public key (downloading the signatures).

這個地方命令粘錯,報錯了, 我沒看到

於是執行了:

[[email protected] opt]# rvm remove 1.8.7
-bash: rvm: command not found
[[email protected] opt]# source /usr/local/rvm/scripts/rvm
-bash: /usr/local/rvm/scripts/rvm: 沒有那個檔案或目錄

去/usr/local/rvm 裡面看了看  沒有 scripts/rvm 這個東西

往上翻了翻  才發現命令執行錯誤

於是重新執行了 那兩個安裝rvm的命令

[[email protected] rvm]# gpg --keyserver hkp://keys.gnupg.net --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3 7D2BAF1CF37B13E2069D6956105BD0E739499BDB
gpg: 下載金鑰‘D39DC0E3’,從 hkp 伺服器 keys.gnupg.net
gpg: 下載金鑰‘39499BDB’,從 hkp 伺服器 keys.gnupg.net
gpg: /root/.gnupg/trustdb.gpg:建立了信任度資料庫
gpg: 金鑰 D39DC0E3:公鑰“Michal Papis (RVM signing) <[email protected]>”已匯入
gpg: 金鑰 D39DC0E3:公鑰“Totally Legit Signing Key <[email protected]>”已匯入
gpg: 金鑰 39499BDB:公鑰“Piotr Kuczynski <[email protected]>”已匯入
gpg: 沒有找到任何絕對信任的金鑰
gpg: 合計被處理的數量:3
gpg:           已匯入:3  (RSA: 3)
[[email protected] rvm]# curl -sSL https://get.rvm.io | bash -s stable
Downloading https://github.com/rvm/rvm/archive/1.29.4.tar.gz
Downloading https://github.com/rvm/rvm/releases/download/1.29.4/1.29.4.tar.gz.asc
gpg: 於 2018年07月02日 星期一 03時41分26秒 CST 建立的簽名,使用 RSA,鑰匙號 BF04FF17
gpg: 完好的簽名,來自於“Michal Papis (RVM signing) <[email protected]>”
gpg:               亦即“Michal Papis <[email protected]>”
gpg:               亦即“[jpeg image of size 5015]”
gpg: 警告:這把金鑰未經受信任的簽名認證!
gpg:       沒有證據表明這個簽名屬於它所聲稱的持有者。
主鑰指紋: 409B 6B17 96C2 7546 2A17  0311 3804 BB82 D39D C0E3
子鑰指紋: 62C9 E5F4 DA30 0D94 AC36  166B E206 C29F BF04 FF17
GPG verified '/usr/local/rvm/archives/rvm-1.29.4.tgz'

 

 這時候我想把舊版本的ruby直接解除安裝

[[email protected] rvm]# ruby -v
ruby 1.8.7 (2013-06-27 patchlevel 374) [x86_64-linux]
[[email protected] rvm]# rvm remove 1.8.7
awk: 命令列:1: 致命錯誤: 無法以讀模式開啟檔案“/usr/local/rvm/config/alias”(沒有那個檔案或目錄)
ruby-1.8.7-head - #already gone
Now using system ruby.
[[email protected] rvm]# ruby -v
ruby 1.8.7 (2013-06-27 patchlevel 374) [x86_64-linux]

又報錯了 然後又百度百度 也沒找到答案  發現很多遇到這問題的都是先安裝  切換 再解除安裝的

於是我就安裝的了最新版的Ruby

[[email protected] config]# rvm install 2.5.3
Searching for binary rubies, this might take some time.
No binary rubies available for: centos/6/x86_64/ruby-2.5.3.
Continuing with compilation. Please read 'rvm help mount' to get more information on binary rubies.
Checking requirements for centos.

這裡只是截取了一部分,而且執行時間有點長

然後切換 解除安裝一氣呵成

[[email protected] config]# rvm use 2.5.3
Using /usr/local/rvm/gems/ruby-2.5.3
[[email protected] config]# rvm remove 1.8.7
ruby-1.8.7-head - #already gone
Using /usr/local/rvm/gems/ruby-2.5.3
[[email protected] config]# ruby -v
ruby 2.5.3p105 (2018-10-18 revision 65156) [x86_64-linux]

 

執行還是報錯

[[email protected] config]# gem install redis-4.0.11
ERROR:  Could not find a valid gem 'redis-4.0.11' (>= 0) in any repository

然後查百度  安裝

[[email protected] opt]# gem install -l redis-4.0.3.gem 
Successfully installed redis-4.0.3
Parsing documentation for redis-4.0.3
Installing ri documentation for redis-4.0.3
Done installing documentation for redis after 0 seconds
1 gem installed

執行還是報錯:

[[email protected] opt]# gem install redis-4.0.11
ERROR:  Could not find a valid gem 'redis-4.0.11' (>= 0) in any repository

後來看百度 執行redis-3.0.0或者redis

於是:

[[email protected] opt]# gem install redis
Successfully installed redis-4.0.3
Parsing documentation for redis-4.0.3
Done installing documentation for redis after 0 seconds
1 gem installed

執行成功  才恍然大悟,redis後面的版本號是 redis-4.0.3.gem  的版本,不是你安裝的redis的版本

踩坑固然痛苦,但是跳出坑的喜悅只有你自己知道。