当前位置: 首页 > news >正文

【日常积累】指定ruby版本环境安装

背景说明

在redis的5.0版本之前,使用redis提供的redis-trib创建redis集群时还需要依赖ruby环境。当然有时候我们自已也需要安装指定ruby版本环境。下面是安装时的大致过程,以及过程中遇到的问题解决。我使用的环境是centos7,小版本差别应该不是很大,具体请自行测试。

安装

先安装ruby

#安装ruby环境
[root@k8s-m1 redis]# yum install ruby 
......
#gem是ruby的包管理工具,该命令可以安装ruby-redis依赖
[root@k8s-m1 redis]# gem install redis
Fetching: connection_pool-2.4.1.gem (100%)
ERROR:  Error installing redis:
connection_pool requires Ruby version >= 2.5.0.

可以看到在使用gem安装ruby-redis的依赖时,出现了报错。需要Ruby版本大于2.5.0。

安装rvm

先安装rvm,通过rvm来安装所需版本的ruby

# 确认自己环境的ruby版本确实低于2.5.0
[root@k8s-m1 ~]# ruby --version
ruby 2.0.0p648 (2015-12-16) [x86_64-linux] [root@k8s-m1 ~]# curl -sSL https://get.rvm.io | bash -s stable
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: Signature made Sat 16 Jan 2021 02:46:22 AM CST using RSA key ID 39499BDB
gpg: Can't check signature: No public key
GPG signature verification failed for '/usr/local/rvm/archives/rvm-1.29.12.tgz' - 'https://github.com/rvm/rvm/releases/download/1.29.12/1.29.12.tar.gz.asc'! Try to install GPG v2 and then fetch the public key:gpg2 --keyserver hkp://keyserver.ubuntu.com --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3 7D2BAF1CF37B13E2069D6956105BD0E739499BDBor 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# 上面在下载安装时有报错,在返回的结果中有说明尝试方法,我选用的最后一个
[root@k8s-m1 ~]# curl -sSL https://rvm.io/mpapis.asc | gpg2 --import -
gpg: keyring `/root/.gnupg/secring.gpg' created
gpg: /root/.gnupg/trustdb.gpg: trustdb created
gpg: key D39DC0E3: public key "Michal Papis (RVM signing) <mpapis@gmail.com>" imported
gpg: Total number processed: 1
gpg:               imported: 1  (RSA: 1)
gpg: no ultimately trusted keys found
[root@k8s-m1 ~]# curl -sSL https://get.rvm.io | bash -s stable^C
[root@k8s-m1 ~]#  curl -sSL https://rvm.io/pkuczynski.asc | gpg2 --import -
gpg: key 39499BDB: public key "Piotr Kuczynski <piotr.kuczynski@gmail.com>" imported
gpg: Total number processed: 1
gpg:               imported: 1  (RSA: 1)

导入相应的key后再进行尝试安装,可以正常安装

[root@k8s-m1 ~]# curl -sSL https://get.rvm.io | bash -s stable
Downloading https://github.com/rvm/rvm/archive/1.29.12.tar.gz
curl: (52) Empty reply from serverCould not download 'https://github.com/rvm/rvm/archive/1.29.12.tar.gz'.curl returned status '52'.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 Sat 16 Jan 2021 02:46:26 AM CST using RSA key ID 39499BDB
gpg: Good signature from "Piotr Kuczynski <piotr.kuczynski@gmail.com>"
gpg: WARNING: This key is not certified with a trusted signature!
gpg:          There is no indication that the signature belongs to the owner.
Primary key fingerprint: 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 [0m
Please consider donating to our open collective to help us maintain RVM.Donate: https://opencollective.com/rvm/donate[root@k8s-m1 ~]# source  /usr/local/rvm/scripts/rvm # 查看rvm库中已知的ruby版本
[root@k8s-m1 ~]# rvm list known
# MRI Rubies
[ruby-]1.8.6[-p420]
[ruby-]1.8.7[-head] # security released on head
[ruby-]1.9.1[-p431]
[ruby-]1.9.2[-p330]
[ruby-]1.9.3[-p551]
[ruby-]2.0.0[-p648]
[ruby-]2.1[.10]
[ruby-]2.2[.10]
[ruby-]2.3[.8]
[ruby-]2.4[.10]
[ruby-]2.5[.8]
[ruby-]2.6[.6]
[ruby-]2.7[.2]
[ruby-]3[.0.0]
ruby-head
......
# 此处省略了很多信息

安装指定ruby版本

从上可以看到支持安装很多版本的ruby版本,起初我直接安装的2.5.8版本,后续安装依赖时会报如下的错误。所以我重新安装了ruby3.0版本。各位不信邪的话可以自行尝试。

[root@k8s-m1 ~]# gem install redis
Fetching connection_pool-2.4.1.gem
Fetching redis-client-0.21.1.gem
Fetching redis-5.1.0.gem
Successfully installed connection_pool-2.4.1
ERROR:  Error installing redis:The last version of redis-client (>= 0.17.0) to support your Ruby & RubyGems was 0.19.1. Try installing it with `gem install redis-client -v 0.19.1` and then running the current command againredis-client requires Ruby version >= 2.6.0. The current ruby version is 2.5.8.224.

安装3.0版本

[root@k8s-m1 ~]# rvm install 3.0
Searching for binary rubies, this might take some time.
No binary rubies available for: centos/7/x86_64/ruby-3.0.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-3.0.0, this may take a while depending on your cpu(s)...
ruby-3.0.0 - #downloading ruby-3.0.0, this may take a while depending on your connection...% Total    % Received % Xferd  Average Speed   Time    Time     Time  CurrentDload  Upload   Total   Spent    Left  Speed
100 18.6M  100 18.6M    0     0   393k      0  0:00:48  0:00:48 --:--:-- 1215k
ruby-3.0.0 - #extracting ruby-3.0.0 to /usr/local/rvm/src/ruby-3.0.0.....
ruby-3.0.0 - #configuring.........................................................................
ruby-3.0.0 - #post-configuration..
ruby-3.0.0 - #compiling............................................................................................
ruby-3.0.0 - #installing....................................
ruby-3.0.0 - #making binaries executable...
Installed rubygems 3.2.3 is newer than 3.0.9 provided with installed ruby, skipping installation, use --force to force installation.
ruby-3.0.0 - #gemset created /usr/local/rvm/gems/ruby-3.0.0@global
ruby-3.0.0 - #importing gemset /usr/local/rvm/gemsets/global.gems................................................................
ruby-3.0.0 - #generating global wrappers........
ruby-3.0.0 - #gemset created /usr/local/rvm/gems/ruby-3.0.0
ruby-3.0.0 - #importing gemsetfile /usr/local/rvm/gemsets/default.gems evaluated to empty gem list
ruby-3.0.0 - #generating default wrappers........
ruby-3.0.0 - #adjusting #shebangs for (gem irb erb ri rdoc testrb rake).
Install of ruby-3.0.0 - #complete 
Ruby was built without documentation, to build it run: rvm docs generate-ri

设置使用默认版本

# 使用一个ruby版本
[root@k8s-m1 ~]# rvm use 3.0
Using /usr/local/rvm/gems/ruby-3.0.0
# 可选择移除之前的版本
[root@k8s-m1 ~]# rvm remove 2.5.8
ruby-2.5.8 - #removing rubies/ruby-2.5.8..
ruby-2.5.8 - #removing gems....
ruby-2.5.8 - #removing aliases
ruby-2.5.8 - #removing wrappers....
ruby-2.5.8 - #removing environments....
Now using system ruby.
[root@k8s-m1 ~]# ruby --version
ruby 3.0.0p0 (2020-12-25 revision 95aff21468) [x86_64-linux]
[root@k8s-m1 ~]# 

再次安装ruby-redis的相关依赖

[root@k8s-m1 ~]# gem install redisFetching redis-5.1.0.gem
Fetching connection_pool-2.4.1.gem
Fetching redis-client-0.21.1.gem
Successfully installed connection_pool-2.4.1
Successfully installed redis-client-0.21.1
Successfully installed redis-5.1.0
Parsing documentation for connection_pool-2.4.1
Installing ri documentation for connection_pool-2.4.1
Parsing documentation for redis-client-0.21.1
Installing ri documentation for redis-client-0.21.1
Parsing documentation for redis-5.1.0
Installing ri documentation for redis-5.1.0
Done installing documentation for connection_pool, redis-client, redis after 1 seconds
3 gems installed

以上就是指定版本的ruby安装,建议一般情况下,可以直接安装支持的最高版本。

相关文章:

【日常积累】指定ruby版本环境安装

背景说明 在redis的5.0版本之前&#xff0c;使用redis提供的redis-trib创建redis集群时还需要依赖ruby环境。当然有时候我们自已也需要安装指定ruby版本环境。下面是安装时的大致过程&#xff0c;以及过程中遇到的问题解决。我使用的环境是centos7&#xff0c;小版本差别应该不…...

SOC内部集成网络MAC外设+ PHY网络芯片方案:MII/RMII 接口与 MDIO 接口

一. 简介 本文来了解一下常用的一种网络硬件方案&#xff1a;SOC内部集成网络MAC外设 PHY网络芯片方案。 其中涉及的 MII接口&#xff0c;RMII接口&#xff08;MII接口与RMII接口二选一&#xff09;&#xff0c;MDIO接口&#xff0c;RJ45。 二. MII/RMII 接口&#xff0c;M…...

简单了解HTTP和HTTPS

HTTP的安全问题&#xff1f; 我们都知道HTTP是不安全的&#xff0c;而HTTPS是安全的&#xff0c;那HTTP有哪些安全问题呢&#xff1f;&#xff08;考虑传输过程以及响应方&#xff09; 明文传输&#xff0c;有窃听风险&#xff1a;HTTP协议无法加密数据&#xff0c;所有通信数…...

系列学习前端之第 9 章:一文搞懂 Node.js 和 nvm,掌握 npm

1、说说 Node.js Node.js 本质上是一款应用软件&#xff08;本质上与QQ、微信一样&#xff09;&#xff0c;它可以运行 JavaScript 代码&#xff0c;这样就使得 JavaScript 能够脱离浏览器运行。Node.js 是基于 Google 的 V8 引擎&#xff0c;V8引擎执行 Javascript 的速度非常…...

超强命令行解析工具Apache Commons CLI

概述 为什么要写这篇文章呢?因为在读flink cdc3.0源码的时候发现了这个工具包,感觉很牛,之前写过shell命令,shell是用getopts来处理命令行参数的,但是其实写起来很麻烦,长时间不写已经完全忘记了,现在才发现原来java也有这种工具类,所以先学习一下这个的使用,也许之后自己在写…...

JAVAEE——多线程进阶,锁策略

文章目录 锁策略乐观锁和悲观锁乐观锁悲观锁两者的比较 读写锁重量级锁和轻量级锁重量级锁轻量级锁 自旋锁公平锁和非公平锁公平锁非公平锁 可重入锁和不可重入锁可重入锁不可重入锁 锁策略 乐观锁和悲观锁 乐观锁 什么是乐观锁呢&#xff1f;我们可以认为乐观锁比较自信&am…...

富文本编辑器Quill全套教程

Quill简介 Quill是一款现代的富文本编辑器&#xff0c;它以其API驱动的设计和对文本格式的深度理解而著称。与传统的富文本编辑器不同&#xff0c;Quill专注于以字符为中心&#xff0c;构建了一个直观且易于使用的API&#xff0c;使得开发者能够轻松地对文本进行格式化和编辑。…...

Swift 代码注释的使用

Swift代码注释的使用 在 iOS 开发中&#xff0c;代码注释是一种很好的实践&#xff0c;可以帮助他人更容易理解你的代码。通常可以在代码中使用注释来解释代码的功能、目的、实现细节等。下面是一些常见的 iOS 代码注释示例&#xff1a; 1. 单行注释&#xff1a; // 这是一个…...

蓝桥杯—DS1302

目录 1.管脚 2.时序&官方提供的读写函数 3.如何使用读写函数 4.如何在数码管中显示在DS1302中读取出的数据&#xff1f; 1.管脚 2.时序&官方提供的读写函数 /* # DS1302代码片段说明1. 本文件夹中提供的驱动代码供参赛选手完成程序设计参考。2. 参赛选手可以自行…...

nginx: 集群环境配置搭建

nginx 集群环境搭建 1 ) 概述 nginx 本身就应该选择性能强劲的机器同时为了满足更多流量的需求, 多台nginx 机器做集群来满足强大的需求故而&#xff0c;我们需要一个负载均衡器&#xff0c;以及多台nginx的机器 这里负载均衡器应该有主从和热备&#xff0c;目前先使用一台来描…...

Linux:进程终止和等待

一、进程终止 main函数的返回值也叫做进程的退出码&#xff0c;一般0表示成功&#xff0c;非零表示失败。我们也可以用不同的数字来表示不同失败的原因。 echo $?//打印最近一次进程执行的退出码 而作为程序猿&#xff0c;我们更需要知道的是错误码所代表的错误信息&#x…...

一、next-auth 身份验证凭据-使用电子邮件和密码注册登录

一、next-auth 身份验证凭据-使用电子邮件和密码注册登录 文章目录 一、next-auth 身份验证凭据-使用电子邮件和密码注册登录一、前言二、前置准备1、环境配置2、相关库安装&#xff08;1&#xff09;vercel 配置&#xff08;2&#xff09;Yarn 包管理配置 3、next项目初始化与…...

2.SpringBoot利用Thymeleaf实现页面的展示

什么是Thymeleaf&#xff1f; Thymeleaf是一个现代服务器端Java模板引擎&#xff0c;适用于Web和独立环境&#xff0c;能够处理HTML&#xff0c;XML&#xff0c;JavaScript&#xff0c;CSS甚至纯文本。 Thymeleaf的主要目标是提供一种优雅且高度可维护的模板创建方式。为实现这…...

devtool: ‘source-map‘ 和 devtool: ‘#source-map‘的区别

devtool: ‘source-map’ 和 devtool: ‘#source-map’ 之间的区别主要在于前面的#字符。 从Webpack 4开始&#xff0c;就废弃了在devtool选项前加#的用法。 devtool: ‘source-map’ 选项意味着Webpack在构建过程中会生成独立的完整的source map文件。对于测试环境很有用&…...

Flutter Boost 3

社区的 issue 没有收敛的趋势。 设计过于复杂&#xff0c;概念太多。这让一个新手看 FlutterBoost 的代码很吃力。 这些问题促使我们重新梳理设计&#xff0c;为了彻底解决这些顽固的问题&#xff0c;我们做一次大升级&#xff0c;我们把这次升级命名为 FlutterBoost 3.0&am…...

ElementUI响应式Layout布局xs,sm,md,lg,xl

响应式布局 参照了 Bootstrap 的 响应式设计&#xff0c;预设了五个响应尺寸&#xff1a;xs、sm、md、lg 和 xl。 <el-row :gutter"10"><el-col :xs"8" :sm"6" :md"4" :lg"3" :xl"1"><div class…...

机器学习——典型的卷积神经网络

机器学习——典型的卷积神经网络 卷积神经网络&#xff08;Convolutional Neural Networks&#xff0c;CNNs&#xff09;是一类在图像处理领域应用广泛的深度学习模型。它通过卷积操作和池化操作来提取图像的特征&#xff0c;并通过全连接层来进行分类或回归任务。在本文中&am…...

速通数据结构与算法第四站 双链表

系列文章目录 速通数据结构与算法系列 1 速通数据结构与算法第一站 复杂度 http://t.csdnimg.cn/sxEGF 2 速通数据结构与算法第二站 顺序表 http://t.csdnimg.cn/WVyDb 3 速通数据结构与算法第三站 单链表 http://t.csdnimg.cn/cDpcC 感谢佬们…...

51单片机学习笔记12 SPI接口 使用1302时钟

51单片机学习笔记12 SPI接口 使用1302时钟 一、DS1302简介1. 功能特性2. 涓流充电3. 接口介绍时钟数据和控制线&#xff1a;电源线&#xff1a;备用电池连接&#xff1a; 二、寄存器介绍1. 控制寄存器2. 时间寄存器3. 日历/时钟寄存器 三、BCD码介绍四、DS1302时序1. 读时序2. …...

php编辑器 ide 主流编辑器的优缺点。phpstorm vscode atom 三者对比

编辑器PhpStormvscodeAtom是否收费收费&#xff0c;有30天试用期免费免费内存占用Java平台&#xff0c;一个进程1G多内存占用好几个进程&#xff0c;合起来1G上下/基本功能都具备&#xff0c;有的功能需要装插件都具备&#xff0c;有的功能需要装插件都具备&#xff0c;有的功能…...

关于iview组件中使用 table , 绑定序号分页后序号从1开始的解决方案

问题描述&#xff1a;iview使用table 中type: "index",分页之后 &#xff0c;索引还是从1开始&#xff0c;试过绑定后台返回数据的id, 这种方法可行&#xff0c;就是后台返回数据的每个页面id都不完全是按照从1开始的升序&#xff0c;因此百度了下&#xff0c;找到了…...

【git】把本地更改提交远程新分支feature_g

创建并切换新分支 git checkout -b feature_g 添加并提交更改 git add . git commit -m “实现图片上传功能” 推送到远程 git push -u origin feature_g...

k8s业务程序联调工具-KtConnect

概述 原理 工具作用是建立了一个从本地到集群的单向VPN&#xff0c;根据VPN原理&#xff0c;打通两个内网必然需要借助一个公共中继节点&#xff0c;ktconnect工具巧妙的利用k8s原生的portforward能力&#xff0c;简化了建立连接的过程&#xff0c;apiserver间接起到了中继节…...

Mysql8 忘记密码重置,以及问题解决

1.使用免密登录 找到配置MySQL文件&#xff0c;我的文件路径是/etc/mysql/my.cnf&#xff0c;有的人的是/etc/mysql/mysql.cnf 在里最后加入 skip-grant-tables重启MySQL服务 service mysql restartShutting down MySQL… SUCCESS! Starting MySQL… SUCCESS! 重启成功 2.登…...

DingDing机器人群消息推送

文章目录 1 新建机器人2 API文档说明3 代码编写 1 新建机器人 点击群设置 下滑到群管理的机器人&#xff0c;点击进入 添加机器人 选择自定义Webhook服务 点击添加 设置安全设置&#xff0c;详见说明文档 成功后&#xff0c;记录Webhook 2 API文档说明 点击设置说明 查看自…...

C#学习第29天:表达式树(Expression Trees)

目录 什么是表达式树&#xff1f; 核心概念 1.表达式树的构建 2. 表达式树与Lambda表达式 3.解析和访问表达式树 4.动态条件查询 表达式树的优势 1.动态构建查询 2.LINQ 提供程序支持&#xff1a; 3.性能优化 4.元数据处理 5.代码转换和重写 适用场景 代码复杂性…...

宇树科技,改名了!

提到国内具身智能和机器人领域的代表企业&#xff0c;那宇树科技&#xff08;Unitree&#xff09;必须名列其榜。 最近&#xff0c;宇树科技的一项新变动消息在业界引发了不少关注和讨论&#xff0c;即&#xff1a; 宇树向其合作伙伴发布了一封公司名称变更函称&#xff0c;因…...

android13 app的触摸问题定位分析流程

一、知识点 一般来说,触摸问题都是app层面出问题,我们可以在ViewRootImpl.java添加log的方式定位;如果是touchableRegion的计算问题,就会相对比较麻烦了,需要通过adb shell dumpsys input > input.log指令,且通过打印堆栈的方式,逐步定位问题,并找到修改方案。 问题…...

数据结构:递归的种类(Types of Recursion)

目录 尾递归&#xff08;Tail Recursion&#xff09; 什么是 Loop&#xff08;循环&#xff09;&#xff1f; 复杂度分析 头递归&#xff08;Head Recursion&#xff09; 树形递归&#xff08;Tree Recursion&#xff09; 线性递归&#xff08;Linear Recursion&#xff09;…...

保姆级【快数学会Android端“动画“】+ 实现补间动画和逐帧动画!!!

目录 补间动画 1.创建资源文件夹 2.设置文件夹类型 3.创建.xml文件 4.样式设计 5.动画设置 6.动画的实现 内容拓展 7.在原基础上继续添加.xml文件 8.xml代码编写 (1)rotate_anim (2)scale_anim (3)translate_anim 9.MainActivity.java代码汇总 10.效果展示 逐帧…...