CentosInstallationMongoDB C + + dirver Objective:
The picture can't be displayed, but the pictures are added later.
Website address:https://www.mongodb.org/
Drive:
https://docs.mongodb.org/ecosystem/drivers/?_ga=1.81586452.2024551820.1440643898
Download release version
Official website Installation Tutorial Address:https://docs.mongodb.org/ecosystem/drivers/cpp/
Installation Environment centos-5.10-x86_64
MongoDB Server-side version:mongodb-linux-x86_64-3.0.6
Driver version:mongo-cxx-driver-legacy-1.0.5
boost version : boost_1_59_0.tar.gz
scons version -2.3.6-1.noarch
Compile dependencies:
Test Case Address:
https://github.com/mongodb/mongo-cxx-driver/wiki#legacy-driver-documentation
API Manual address:
http://api.mongodb.org/cxx/current/
Driver related Manuals address:
http://docs.mongodb.org/ecosystem/drivers/cpp/
Steps:
1.Installationscons
Mongo C + + drivers are installed by SCons compilation
Scons2.3.6 needs python >= 2.7,
If python is below 2.7, you need to upgrade
Upgrade to 2.7 step
# wget http://www.python.org/ftp/python/2.7.3/Python-2.7.3.tgz
TAR-ZXVF python-2.7.3.tar.bz2
Build a folder in/usr/local before compiling python27 (as a Python installation path to avoid overwriting the old version)
Mkdir/usr/local/python27
Compile the installation in the unzipped directory
./configure --prefix=/usr/local/python27
Make
Makeinstall
The old version is not overwritten at this time , then the original/usr/bin/python link is changed to another name
Mv/usr/bin/python/usr/bin/python_old
Link to build a new version of Python
ln-s/usr/local/python27/bin/python2.7 /usr/bin/python
Input
Pyton View Version
2.InstallationBoost
The boost version needs to be larger than 1.49, and if the boostis already installed, it needs to be upgraded if the version is too low. Otherwise you can omit this step
Unzip the source package :
Enter the directory, execute the following command, compile the installation
$./bootstrap.sh
.....
$./b2
.....
$ sudo./b2 Install
3.CompileMongoDB C + + dirver
Use the command, other parameters can participate in the official website
Note the above command:mogo-client-install changed to mogo-client-install
Error 1was encountered at compile time:
Use parameters:
disable-warnings-as-errors
To add a system library load path:
Modify File /etc/ld.so.conf
Is the configuration file takes effect immediately:
Test:
Test.cpp
Compile:
g++ test.cpp-lmongoclient-lboost_system-lboost_thread-lboost_filesystem-lboost_program_options-i/usr/local/ Mongo-client-install/include-l/usr/local/mongo-client-install/lib-lboost_regex
If the output connect OK indicates success.
Other test cases are given in the preface to the official website address.
Centos Install MongoDB C + + Dirver