“How to Install Ruby2.3 on centos7”的版本间的差异

来自linux中国网wiki
跳到导航 跳到搜索
docker>Evan
(创建页面,内容为“ =rvm= <pre> #yum install ruby 高版本 # on java02 yum -y install curl #gpg2 --keyserver hkp://keys.gnupg.net --recv-keys D39DC0E3 gpg2 --keyserver hkp://poo…”)
 
(导入1个版本)

2019年10月14日 (一) 13:48的版本

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、配置文件生效 
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就表示成功了 

CentOS提示ruby版本过低升级ruby完整步骤

解决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 支持的解决方法 (已解决)

gem install redis报错解决办法