1.首先安装依赖包:
sudo yum install cyrus-sasl cyrus-sasl-devel.x86_64 cyrus-sasl.x86_64 cyrus-sasl-lib.x86_64 cyrus-sasl-plain.x86_64 cyrus-sasl-gssapi cyrus-sasl-plain krb5-libs libcurl libpcap lm_sensors-libs net-snmp net-snmp-agent-libs openldap openssl openssl-devel rpm-libs tcp_wrappers-libs
2.安装编译snappy
wget https://github.com/google/snappy/tarball/master
tar -xzf master
cd ./google-snappy-156cd89/cmake
sudo cmake -DBUILD_SHARED_LIBS=ON ..
sudo make -j6
sudo make install
cd ../../
3.安装编译icu
wget http://download.icu-project.org/files/icu4c/4.2.1/icu4c-4_2_1-src.tgz
tar -xzf icu4c-4_2_1-src.tgz
cd ./icu/source
./configure
sudo make -j6
sudo make install
cd ../../
4.安装编译mongo-c-driver
wget https://github.com/mongodb/mongo-c-driver/releases/download/1.13.0/mongo-c-driver-1.13.0.tar.gz
tar xzf mongo-c-driver-1.13.0.tar.gz
cd ./mongo-c-driver-1.13.0
mkdir cmake-build
cd cmake-build
sudo cmake -DENABLE_AUTOMATIC_INIT_AND_CLEANUP=OFF ..
sudo make -j6
sudo make install
cd ../../
4.安装编译mongo-cxx-driver
curl -OL https://github.com/mongodb/mongo-cxx-driver/archive/r3.4.0.tar.gz
tar -xzf r3.4.0.tar.gz
cd ./mongo-cxx-driver-r3.4.0/build
sudo cmake -DCMAKE_BUILD_TYPE=Release -DBSONCXX_POLY_USE_MNMLSTC=1 -DCMAKE_INSTALL_PREFIX=/usr/local ..
sudo make EP_mnmlstc_core
sudo make -j6
sudo make install
參考:https://www.cnblogs.com/ealamyan/p/9903299.html