原文链接:http://chinacheng.iteye.com/blog/1480145
情况大体是这样的,接手了别人在配的一台服务器,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重新编译之后问题成功了,也没有必要去复现这个问题了
====================================================================
http://netfork.iteye.com/blog/432928
passenger编译安装nginx的时候出错:
checking for openssl/ssl.h... no
一、安装openssl扩展
编译安装
- tar -zxvf openssl-0.9.8k.tar.gz
- cd openssl-0.9.8k
- ./configure
- make && make install
二、然后到源码
文件夹的/ext/openssl文件夹
- cd ruby-1.8.7-p330/ext/openssl
- ruby extconf.rb --with-openssl-include=/usr/local/ssl/include/ --with-openssl-lib=/usr/local/ssl/lib
- make && make install
如果遇到
- /usr/bin/ld: /usr/local/ssl/lib/libssl.a(s2_meth.o): relocation R_X86_64_32 against `a local symbol' can not be used when making a shared object; recompile with -fPIC
- /usr/local/ssl/lib/libssl.a: could not read symbols: Bad value
- collect2: ld returned 1 exit status
服务器是64位的,
- ./config shared -fPIC
按照上面命令重新编译openssl
再重新安装ruby的ext扩展
- make distclean
- ruby extconf.rb --with-openssl-include=/usr/local/ssl/include/ --with-openssl-lib=/usr/local/ssl/lib
- make && make install
================================
passenger-install-nginx-moudle 出现如下错误
- StaticContentHandler.c:69: error: ‘ngx_http_request_t’ has no member named ‘zero_in_uri’
注释掉gem包中的
- Delete these line from ${GEM_HOME}/passenger-2.2.15/ext/nginx/StaticContentHandler.c
- if (r->zero_in_uri) {
- return NGX_DECLINED;
- }
参见 https://github.com/hmsk/nginx-passenger-centos
===============================
nginx启动出现错误
- nginx: error while loading shared libraries: libpcre.so.1: cannot open shared object file: No such file or directory
进入/lib64目录中手动链接下(服务器是64位的)
- ln -s libpcre.so.0.0.1 libpcre.so.1