错误一:
[root@Redis-Cluster-Node-1 redis]# gem install redis
ERROR: Loading command: install (LoadError)
cannot load such file -- zlib
ERROR: While executing gem ... (NoMethodError)
undefined method `invoke_with_build_args' for nil:NilClass
加载不了zlib
解决方法:进入ruby的压缩目录
[root@Redis-Cluster-Node-1 redis]# yum -y install zlib-devel
[root@Redis-Cluster-Node-1 redis]# cd /root/ruby-2.4.10/ext/zlib/
[root@Redis-Cluster-Node-1 zlib]# ruby ./extconf.rb
[root@Redis-Cluster-Node-1 zlib]# make
[root@Redis-Cluster-Node-1 zlib]# make install
安装报错
make: *** No rule to make target `/include/ruby.h', needed by `zlib.o'. Stop.
处理方法
[root@Redis-Cluster-Node-1 zlib]# vim Makefile
将 zlib.o: $(top_srcdir)/include/ruby.h替换为zlib.o: ../../include/ruby.h
错误二:
[root@Redis-Cluster-Node-1 redis]# gem install redis
ERROR: While executing gem ... (Gem::Exception)
Unable to require openssl, install OpenSSL and rebuild ruby (preferred) or use non-HTTPS sources
缺少openssl支持
解决方法
[root@Redis-Cluster-Node-1 redis]# yum install openssl-devel -y
[root@Redis-Cluster-Node-1 redis]# cd /root/ruby-2.4.10/ext/openssl/
[root@Redis-Cluster-Node-1 openssl]# ruby ./extconf.rb
make时报错
[root@Redis-Cluster-Node-1 openssl]# make
compiling openssl_missing.c
make: *** No rule to make target `/include/ruby.h', needed by `ossl.o'. Stop.
解决方法
[root@Redis-Cluster-Node-1 openssl]# vim Makefile
在顶部增加
top_srcdir = ../..
然后执行make
[root@Redis-Cluster-Node-1 openssl]# make install