很多人都说自己编译的稳定好用,我也来试试:
1. 参考官方文档,手工编译Spider Monkey
# curl -O ftp://ftp.mozilla.org/pub/mozilla.org/js/js-1.7.0.tar.gz
# tar zxvf js-1.7.0.tar.gz
# cd js/src
# export CFLAGS="-DJS_C_STRINGS_ARE_UTF8"
# make -f Makefile.ref
# JS_DIST=/usr make -f Makefile.ref export
2. 安装scons,用官网的rpm包就行。
3. 重新编译pcre。自带的编译时没带–enable-unicode-properties参数,mongdb启动时会提示:warning: some regex utf8 things will not work. pcre build doesn’t have –enable-unicode-properties. RPMS包是在这里找到的。
# rpm -ivh pcre-6.6-2.el5_1.7.src.rpm
# vi /usr/src/redhat/SPECS/pcre.spec
%configure --enable-utf8
修改成
%configure --enable-utf8 --enable-unicode-properties
# rpmbuild -ba /usr/src/redhat/SPECS/pcre.spec
# rpm -Uvh /usr/src/redhat/RPMS/x86_64/pcre*.rpm
4. 安装1.41版本的boost库。这里可以找到编译好的boost库的RPM包。因为后面要编译成静态库,还需要安装boost141-static-1.41.0-2.el5.i386.rpm
5. 开始编译MongoDB
# cd mongodb-src-r1.8.1
# scons --libpath=/usr/lib64/boost141/ \
--cpppath=/usr/include/boost141/ \
--release --64 --static all
如果你没有–release和–static选项,可能会看见下面这样的消息
*** notice: no readline library, mongo shell will not have nice interactive line editing ***
解决方法是加上–extralib=ncurses。
6. 安装
# cd mongodb-src-r1.8.1
# scons --libpath=/usr/lib64/boost141/ \
--cpppath=/usr/include/boost141/ \
--release --64 --static --prefix=/opt/mongo-1.8.1 install
参考:
1. http://www.mongodb.org/display/DOCS/Building+for+Linux
2. http://hi.baidu.com/farmerluo/blog/item/37364623f35ba55e9922ed2f.html