转自
http://nosql-db.com/topic/51556970ca60a10d420148e4
之前装过,忘了 ,找了篇博客 COPY作记录
MongoDB python和MongoDB c++驱动安装
java 简单,略过。
python
$ git clone git://github.com/mongodb/mongo-python-driver.git pymongo
$ cd pymongo/
$ python setup.py install
c++
安装boost库,推荐1.49版本。
cd boost_1_49_0
./bootstrap.sh
…
./b2
…
./b2 install
下载2.2最新驱动
wget http://downloads.mongodb.org/cxx-driver/mongodb-linux-x86_64-v2.2-latest.tgz
tar zxf mongodb-linux-x86_64-v2.2-latest.tgz
cd mongo-cxx-driver-v2.2
scons
scons install
ldconfig /usr/local/lib
安装成功。
测试
cat tutorial.cpp
#include<cstdlib>#include<iostream>#include"mongo/client/dbclient.h"void run(){
mongo::DBClientConnection c;
c.connect("localhost");}int main(){try{
run();
std::cout <<"connected ok"<< std::endl;}catch(const mongo::DBException&e ){
std::cout <<"caught "<< e.what()<< std::endl;}return EXIT_SUCCESS;}
[root@ccj mongo-cxx-driver-v2.2]#g++ tutorial.cpp -lmongoclient -lboost_thread -lboost_filesystem -lboost_program_options
[root@ccj mongo-cxx-driver-v2.2]# ./a.out
connected ok