RHEL5下编译MongoDB

很多人都说自己编译的稳定好用,我也来试试:

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

在MacOS下使用天翼3G上网卡(华为EC1260)

关键是升级为华为的固件。

  1. 下载华为固件: 通用版客户端软件 中国电信(EC1260/EC1261/EC 189/EC8189/EC169/EC169C/EC122),下载页面
  2. 在使用Windows系统的电脑上运行升级程序。
  3. 在Mac电脑上插入上网卡,会自动运行,提示安装Mobile Partner这个应用程序。
  4. 运行Mobile Partner,在工具菜单里打开设置窗口,新建一个连接配置。号码是#777,用户名和密码都是card。
  5. 保存配置,就可以连接了。