“How to Install Ruby2.3 on centos7”的版本间的差异
跳到导航
跳到搜索
(→rvm) |
(→yum) |
||
(未显示同一用户的4个中间版本) | |||
第2行: | 第2行: | ||
=yum= | =yum= | ||
<pre> | <pre> | ||
− | yum install centos-release-scl-rh | + | yum install centos-release-scl-rh -y |
+ | yum install rh-ruby27 -y | ||
+ | |||
scl enable rh-ruby27 bash | scl enable rh-ruby27 bash | ||
ruby -v | ruby -v | ||
+ | |||
+ | |||
+ | If you'd like to enable Ruby 2.7 automatically at login time, configure like follows. | ||
+ | [root@dlp ~]# vi /etc/profile.d/rh-ruby27.sh | ||
+ | # create new | ||
+ | |||
+ | source /opt/rh/rh-ruby27/enable | ||
+ | export X_SCLS="`scl enable rh-ruby27 'echo $X_SCLS'`" | ||
+ | |||
+ | |||
</pre> | </pre> | ||
+ | |||
=rvm= | =rvm= | ||
<pre> | <pre> | ||
第128行: | 第141行: | ||
[https://blog.csdn.net/feinifi/article/details/78251486 gem install redis报错解决办法] | [https://blog.csdn.net/feinifi/article/details/78251486 gem install redis报错解决办法] | ||
+ | =R= | ||
+ | [https://www.cnblogs.com/ding2016/p/7903147.html centos7/rhel7安装较高版本ruby2.2/2.3/2.4+ ] | ||
+ | [https://blog.csdn.net/qq_26440803/article/details/82717244 Centos7安装升级Ruby] | ||
[[category:ops]] | [[category:ops]] |
2021年11月5日 (五) 03:59的最新版本
yum
yum install centos-release-scl-rh -y yum install rh-ruby27 -y scl enable rh-ruby27 bash ruby -v If you'd like to enable Ruby 2.7 automatically at login time, configure like follows. [root@dlp ~]# vi /etc/profile.d/rh-ruby27.sh # create new source /opt/rh/rh-ruby27/enable export X_SCLS="`scl enable rh-ruby27 'echo $X_SCLS'`"
rvm
#yum install ruby 高版本 # on java02 yum -y install curl #gpg2 --keyserver hkp://keys.gnupg.net --recv-keys D39DC0E3 gpg2 --keyserver hkp://pool.sks-keyservers.net --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3 7D2BAF1CF37B13E2069D6956105BD0E739499BDB curl -L get.rvm.io | bash -s stable 4、查找配置文件 find / -name rvm.sh 5、配置文件生效 由上面的find 来决定 source /etc/profile.d/rvm.sh 6、下载rvm依赖 rvm requirements 7、查看rvm库ruby版本 rvm list known 8、安装ruby指定版本 直接执行 上面两个可选 rvm install ruby-2.3.8 #me rvm install ruby-2.4.1 好像这样默认就是2.3.8了 9、使用ruby版本默认 rvm use 2.3.8 default #rvm use 2.4.1 default rvm use 2.3.3 --default 10、gem install redis test redis-trib.rb #ok就表示成功了
解决redis requires ruby version 2.3.0 https://blog.csdn.net/qq_26440803/article/details/82717244
源码编译
在java01 要记得删除一下 openssl-devel zlib-devel #wget -c https://cache.ruby-china.com/pub/ruby/2.3/ruby-2.3.4.tar.gz wget https://cache.ruby-lang.org/pub/ruby/2.3/ruby-2.3.4.tar.gz tar xvf ruby-2.3.4.tar.gz cd ruby-2.3.4 ./configure --prefix=/usr/local/ruby make -j3 make install cp /usr/local/ruby/bin/ruby /usr/local/bin/ cp /usr/local/ruby/bin/gem /usr/local/bin/ #ins redis 依赖 cd ext/zlib /usr/local/bin/ruby extconf.rb #这个不行 201908 //在操作下一步之前需要修改Makefile文件中的zlib.o: $(top_srcdir)/include/ruby.h,将$(top_srcdir)修改为../..如下 //zlib.o: ../../include/ruby.h //这一步如果不修改,make时会爆出另外一个错误 //make:*** No rule to make target `/include/ruby.h', needed by `zlib.o'. Stop make && make install cd ext/openssl ruby extconf.rb //同样修改Makefile中的$(top_srcdir)为../.. make && make install cd ruby-2.3.4 make -j3 make install cp /usr/local/ruby/bin/ruby /usr/local/bin/ cp /usr/local/ruby/bin/gem /usr/local/bin/ #这个过期了呀 #http://rubygame.org/downloads/redis-3.3.0.gem wget -c https://rubygems.org/downloads/redis-4.0.0.gem gem install redis -v 4.0.0 gem install redis -v 4.0.0 ERROR: Loading command: install (LoadError) cannot load such file -- zlib ERROR: While executing gem ... (NoMethodError) undefined method `invoke_with_build_args' for nil:NilClass [root@prod-cailuw-market-java-01 src]# gem install redis -v 4.0.0 ERROR: While executing gem ... (Gem::Exception) Unable to require openssl, install OpenSSL and rebuild ruby (preferred) or use non-HTTPS sources
https://ruby-china.org/topics/28575 编译的 Ruby 2.3.0 缺少 openssl 支持的解决方法 (已解决)