Centos7 安裝Mongodb的C++ driver

    按照官網(https://github.com/mongodb/mongo-cxx-driver/wiki/Quickstart-Guide-(New-Driver))上說的,C++ driver內部使用了libbson和 MongoDB C driver。所以要安裝C++ driver,需要先安裝C driver。我的系統gcc版本4.8.5,cmake版本3.5.2,達到官網要求的安裝版本。

1.安裝automake, autoconf and libtool,這裏全部yum安裝即可

yum -y install automake autoconf libtool

2.安裝C driver,按照官網(https://github.com/mongodb/mongo-c-driver)給的安裝方法安裝。這裏我裝的是1.3.5版本。

wget https://github.com/mongodb/mongo-c-driver/releases/download/1.3.5/mongo-c-driver-1.3.5.tar.gz
tar xzf mongo-c-driver-1.3.5.tar.gz
cd mongo-c-driver-1.3.5
./configure
make
make install

3.安裝C++ driver,按照官網(https://github.com/mongodb/mongo-cxx-driver/wiki/Quickstart-Guide-(New-Driver))給的安裝方法安裝。這裏我裝的是3.0.1版本。

wget https://github.com/mongodb/mongo-cxx-driver/archive/r3.0.1.tar.gz
tar xzf r3.0.1.tar.gz
cd mongo-cxx-driver-r3.0.1/build
#需要先安裝好git,yum -y install git,不然會報錯
PKG_CONFIG_PATH=/usr/local/lib/pkgconfig cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=/usr/local/ ..
make
make install



發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章