1 从github上clone出moongoo
git clone https://github.com/isage/lua-resty-moongoo.git ./
2 从中lib/resty目录中,拷贝出里面的moongoo目录和moongoo.lua目录到/root/openresty/lualib/resty目录中
3 安装libbson
yum -y install libtool
yum -y install automake
yum -y install autoconf
cd ~
mkdir libbson
cd libbson
git clone https://github.com/mongodb/libbson.git ./
./autogen.sh
make -j2
make install
make clean && make LUA_INCLUDE_DIR=/root/openresty/luajit/include/luajit-2.1 LUA_CMODULE_DIR=/root/openresty/lualib LUA_MODULE_DIR=/root/openresty/lualib CBSON_CFLAGS="-g -fpic -I/usr/local/include/libbson-1.0/ " CC=cc
4 安装cbson
git clone https://github.com/isage/lua-cbson.git ./
cd /root/cbson/lua-cbson/cmake
vim FindLuaJIT.cmake
修改该文件的luajit到自定义的目录下
mkdir build
cd build
cmake
make -j2
make install
5 会遇到一个报错
runtime error:error loading module ‘cbson’ from file xxx
libbson-1.0.so.0: cannot open shared object file: No such file or directory
解决:
vim /etc/ld.so.conf
在末尾添加一行
/usr/local/lib
使得修改生效
/sbin/ldconfig