Redhat装配gem包报错“no such file to load — zlib”

Redhat安装gem包报错“no such file to load — zlib”
情况大体是这样的,接手了别人在配的一台服务器,Red Hat Enterprise Linux Server release 5.5。
至于他的ruby gem之类的安装包是怎么安装的我一概不知,问他他就说按照步骤来的,但是各种问题层出不穷。
首先是环境变量的问题,这个好解决,一步搞定了。
之后是gem包的安装问题,只要运行 gem install * 命令,都会出现下面这个错误:

ERROR:  Loading command: install (LoadError)
no such file to load — zlib
ERROR:  While executing gem … (NameError)
uninitialized constant Gem::Commands::InstallCommand


这个错误,在google上搜索,答案真的是一片一片的,但是所有的答案无非都是下面这几句话,千篇一律整齐划一,好不无奈
引用

install the zlib dev libraries
sudo apt-get install zlib1g-dev

Then go to the source directory from where you compiled the Ruby and there you will find source for zlib.
e.g. /usr/local/src/ruby-1.8.7/ext/zlib
In case, if you used RVM, then it will be here
cd /home/user/.rvm/src/ruby-1.8.7-p352/ext/zlib
And do the following commands
ruby extconf.rb
make
make install


上面这个答案明显是针对ubuntu的,我这台服务器既不能联外网,又不是ubuntu,所以完全不能效颦

我去搜索zlib包,几乎完全被ubuntu的deb文件刷屏,最后还好找到了(见附件)
configure & make & make install
很顺利,很成功
但是仍然有错误,我把gem重新安装还是没用的,于是怀疑是ruby在编译安装的时候没有编译这个zlib。
干脆把ruby重新编译安装,问题搞定,看来就是上面我猜测的这个原因。

之后我觉得,上面引文中的
/home/user/.rvm/src/ruby-1.8.7-p352/ext/zlib 目录下 去扩展一下也应该是可以的
ruby extconf.rb
make
make install

只是我这边ruby重新编译之后问题成功了,也没有必要去复现这个问题了