系统:centos7.2
说明所有源码放在
1、准备mongoDB C/C++驱动依赖
yum -y install epel-release
yum install -y git gcc gcc-c++ openssl openssl-devel make texinfo patch imake wget perl-Test-Harness perl-Thread-Queue perl-Data-Dumper help2man cyrus-sasl-devel glib-devel gettext gettext-devel gnulib-devel
2、安装cmake3.2以上版本如果有旧请卸载
yum remove cmake wget https://www.cmake.org/files/v3.2/cmake-3.2.2.tar.gz tar -xvf cmake-3.2.2.tar.gz cd cmake-3.2.2 ./bootstrap ./configure make && make install ln -s /usr/local/bin/cmake /usr/bin cd ..
3、安装autoconf-2.69
wget http://mirrors.kernel.org/gnu/autoconf/autoconf-2.69.tar.gz tar -xvf autoconf-2.69.tar.gz cd autoconf-2.69 ./configure --prefix=/usr/local make && make install cd ..
4、安装automake-1.15.1
wget http://ftp.gnu.org/gnu/automake/automake-1.15.1.tar.xz tar -xvf automake-1.15.1.tar.xz cd automake-1.15.1 ./bootstrap --force ./configure --prefix=/usr/local make && make install ln -sf /usr/local/bin/automake-1.15 /usr/bin/automake cd ..
5、安装libtool-2.4.6
wget http://mirrors.ustc.edu.cn/gnu/libtool/libtool-2.4.6.tar.gz tar -xvf libtool-2.4.6.tar.gz cd libtool-2.4.6 ./bootstrap --force ./configure make && make install cd ..
6、安装libbson-1.6.3
wget https://github.com/mongodb/libbson/releases/download/1.6.3/libbson-1.6.3.tar.gz tar -xvf libbson-1.6.3.tar.gz cd libbson-1.6.3 ./configure -prefix=/usr --libdir=/usr/lib64 make && make install cd ..
7、安装m4-1.4.18
wget http://mirrors.kernel.org/gnu/m4/m4-1.4.18.tar.gz tar -xvf m4-1.4.18.tar.gz cd m4-1.4.18 ./bootstrap --force ./configure --prefix=/usr/local make && make install ln -sf /usr/local/bin/m4 /usr/bin/m4 cd ..
8、安装mongo-c-driver-1.6.3
wget https://github.com/mongodb/mongo-c-driver/releases/download/1.6.3/mongo-c-driver-1.6.3.tar.gz tar -xvf mongo-c-driver-1.6.3.tar.gz cd mongo-c-driver-1.6.3 ./configure make && make install cd ..
9、安装mongo-cxx-driver-r3.1.2
wget https://github.com/mongodb/mongo-cxx-driver/archive/r3.1.2.tar.gz tar -xvf r3.1.2.tar.gz cd mongo-cxx-driver-r3.1.2/build/ PKG_CONFIG_PATH=/usr/local/lib/pkgconfig cmake -DCMAKE_BUILD_TYPE=Release -DBSONCXX_POLY_USE_MNMLSTC=1 -DCMAKE_INSTALL_PREFIX=/usr/local .. sudo make EP_mnmlstc_core sudo make && sudo make install ln -s /usr/local/lib/libmongocxx.so /usr/lib/libmongocxx.so
本文出自 “小叶寒笑” 博客,请务必保留此出处http://juestnow.blog.51cto.com/1515305/1950039
原文地址:http://juestnow.blog.51cto.com/1515305/1950039