错误一:
***安装集群管理工具安装包
tar -xzf ruby-2.6.3.tar.gz
cd ruby-2.6.3
./configure
make
make install
安装完成后查看版本发现如下错误
[root@rhel2 zlib]# ruby -v
-bash: /usr/bin/ruby: No such file or directory
没有将ruby命令放在默认目录/usr/bin/ruby下,
使用以下命令查查看版本
[root@rhel2 zlib]# /usr/local/bin/ruby --version
ruby 2.6.3p62 (2019-04-16 revision 67580) [x86_64-linux]
创建软连接即可:
[root@rhel2 zlib]# ln -s /usr/local/bin/ruby /usr/bin/ruby
[root@rhel2 zlib]# ruby -v
ruby 2.6.3p62 (2019-04-16 revision 67580) [x86_64-linux]
错误二:
gem安装redis接口时出现如下错误:
[root@rhel2 ruby-2.6.3]# gem install -l ./redis-3.3.5.gem
ERROR: Loading command: install (LoadError)
cannot load such file -- zlib
ERROR: While executing gem ... (NoMethodError)
undefined method `invoke_with_build_args' for nil:NilClass
1、首先安装zlib库
[root@rhel2 ruby-2.6.3]# yum install zlib-devel
2、继承zlib库到ruby环境,这个时候又出现了错误
[root@rhel2 ruby-2.6.3]# cd ext/zlib
[root@rhel2 zlib]# ruby extconf.rb
[root@rhel2 zlib]# make
make: *** No rule to make target `/include/ruby.h', needed by `zlib.o'. Stop.
错误三:
[root@rhel2 zlib]# make
make: *** No rule to make target `/include/ruby.h', needed by `zlib.o'. Stop.
解决:
[root@rhel2 zlib]# vi /ruby-2.6.3/ext/zlib/Makefile
#zlib.o: $(top_srcdir)/include/ruby.h #把这一行替换成下面一行
zlib.o: ../../include/ruby.h
接着上步的make命令执行
[root@rhel2 zlib]# make install
这样就可以了
[root@rhel2 install_gem]# gem install -l ./redis-3.3.5.gem
Successfully installed redis-3.3.5
Parsing documentation for redis-3.3.5
Installing ri documentation for redis-3.3.5
Done installing documentation for redis after 0 seconds
1 gem installed