Building on Unix

Prerequisites

OpenSSL is required for authentication or for SSL connections to MongoDB. Kerberos or LDAP support requires Cyrus SASL.

To install all optional dependencies on RedHat / Fedora:

$ sudo yum install pkg-config openssl-devel cyrus-sasl-devel
On Debian / Ubuntu: $ sudo apt-get install pkg-config libssl-dev libsasl2-dev
On FreeBSD: $ su -c 'pkg install pkgconf openssl cyrus-sasl'

Building from a release tarball

Unless you intend on contributing to the mongo-c-driver, you will want to build from a release tarball.

The most recent release of libmongoc is 1.8.1 and can be downloaded here. The following snippet will download and extract the driver, and configure it:

$ wget https://github.com/mongodb/mongo-c-driver/releases/download/1.8.1/mongo-c-driver-1.8.1.tar.gz
$ tar xzf mongo-c-driver-1.8.1.tar.gz
$ cd mongo-c-driver-1.8.1
$ ./configure --disable-automatic-init-and-cleanup 

亲测:

 https://github.com/mongodb/mongo-c-driver/releases/download/1.8.1/mongo-c-driver-1.8.1.tar.gz 这个地址下载超慢 

所以还是从 git 下载源码

Building from git

To build an unreleased version of the driver from git requires additional dependencies.

RedHat / Fedora:

$ sudo yum install git gcc automake autoconf libtool
Debian / Ubuntu: $ sudo apt-get install git gcc automake autoconf libtool
FreeBSD: $ su -c 'pkg install git gcc automake autoconf libtool'

Once you have the dependencies installed, clone the repository and build the current master or a particular release tag:

$ git clone https://github.com/mongodb/mongo-c-driver.git
$ cd mongo-c-driver
$ git checkout x.y.z # To build a particular release
$ ./autogen.sh --with-libbson=bundled
$ make
$ sudo make install

1.

  下载 mongo-c-driver-r1.6 源码:

    https://github.com/mongodb/mongo-c-driver(GitHub驱动源码,这个 src/libbson 文件夹里面是空的,要单独下载)

  下载 libbson-r1.6 源码:

     https://github.com/mongodb/mongo-c-driver/tree/r1.6/src

2.

  解压:

    unzip mongo-c-driver-r1.6.zip

    unzip libbson-r1.6.zip

3.

  将 libbson 源码 拷贝 至 mongo-c-driver-r1.6/src/libbson 目录

4. 

  sudo yum install pkg-config openssl-devel cyrus-sasl-devel

  ./autogen.sh --with-libbson=bundled (得先安装 libtoll ,否则会报错。sudo yum install libtool*)

  make

  sudo make install

安装完成的库和头文件目录:

  /usr/local/lib

  /usr/local/include

  

  

API 用法详见:http://www.cnblogs.com/SZxiaochun/p/5848455.html

注意:

  使用库的时候报错:

    error while loading shared libraries: libevent-1.4.so.2: cannot open shared object file: No such file or directory

原因:

  程序按照默认共享库路径找不到该共享库文件。

解决方法:

  详见:http://www.cnblogs.com/SZxiaochun/p/7685499.html

MongoDB C Driver Building on CentOS的更多相关文章

  1. MongoDB C Driver Building on Windows

    一.编译mongodb c driver: 需要先安装OpenSSL:(参见:http://bbs.aircheng.com/read-2222-1) 步骤:(MongoDB步) 1.下载Active ...

  2. MongoDB C Driver and APIinstances linux MongoDB安装配置

    <一,linux平台MongoDB安装配置>在这我们使用的Centos6 yum部署的,你想搞编译,自个干!

  3. MongoDB Java Driver操作指南

    MongoDB为Java提供了非常丰富的API操作,相比关系型数据库,这种NoSQL本身的数据也有点面向对象的意思,所以对于Java来说,Mongo的数据结构更加友好. MongoDB在今年做了一次重 ...

  4. MongoDB C Driver使用教程

    MongoDB C Driver使用教程 转载请注明出处http://www.cnblogs.com/oloroso/ 本指南提供简介 MongoDB C 驱动程序. 在 C API 的详细信息,请参 ...

  5. windows平台下安装、编译、使用mongodb C++ driver

    本博客将记录在Win8.1 ,VS2013环境下编译.配置mongodb C++ driver的流程. 1.下载预备 下载Boost:http://sourceforge.net/projects/b ...

  6. Ignoring Extra Elements in mongoDB C# Driver

    MongoDB删除字段后会报错: Element ... does not match any field or property of class Customer. 需要在实体类增加 [BsonI ...

  7. Install MongoDB on Red Hat Enterprise, CentOS, Fedora, or Amazon Linux

    Install MongoDB on Red Hat Enterprise, CentOS, Fedora, or Amazon Linux¶ Overview Use this tutorial t ...

  8. mongodb .net driver

    1.介绍 The official MongoDB .NET Driver provides asynchronous interaction with MongoDB. Powering the d ...

  9. Mongodb Java Driver 参数配置解析

    要正确使用Mongodb Java Driver,MongoClientOptions参数配置对数据库访问的并发性能影响极大. connectionsPerHost:与目标数据库能够建立的最大conn ...

随机推荐

  1. Speech and Language Processing, NLP 处理

    https://www.amazon.com/Speech-Language-Processing-Daniel-Jurafsky/dp/0131873210 http://web.stanford. ...

  2. filezilla修改默认21端口

    一.filezilla修改端口21 1.修改ftp端口号,例如我们想把21修改成888 2.修改数据端口号为N-1,即888-1=887 3.防火墙中开启端口888和887 完成一个FTP的传输过程不 ...

  3. CentIOS PHP 扩展库

    1.GD库 yum -y install php-gd

  4. eclipse中git更新操作

    1,本地已经修改的代码不要commit和push 2,选中工程,右击Team,然后点击Fetch from Upstream,从远程服务器拉取最新的代码 3,上一步操作完成,再右击工程,选中Team, ...

  5. java框架篇---Struts2的处理流程

    一.Struts2的处理流程: 客户端产生一个HttpServletRequest的请求,该请求被提交到一系列的标准过滤器(Filter)组建链中(如ActionContextCleanUp:它主要是 ...

  6. andriod自定义视图

    一.通过View实现自定义视图 通过构造函数创建可视界面 public class MyView extends View { // Constructor required for in-code ...

  7. Linux 下MongoDb的安装

    MongoDb在linux可以说是非常的简单的. 先下载: curl -O https://fastdl.mongodb.org/linux/mongodb-linux-x86_64-3.0.6.tg ...

  8. Android Things专题5 I2C

    文| 谷歌开发人员技术专家, 物联网方向 (IOT GDE) 王玉成(York Wang) 上一讲中.我们说到 Android Things 的 API,以及 Peripheral I/O 设备包括的 ...

  9. Java API学习(一) ArrayList源码学习

    ArrayList在平常用的还挺多的,用起来十分舒服,顺手.这里来学习一下它的源码. 类定义 下面是类的定义: public class ArrayList<E> extends Abst ...

  10. C语言 · 字符串变换

    算法训练 字符串变换   时间限制:1.0s   内存限制:256.0MB      问题描述 相信经过这个学期的编程训练,大家对于字符串的操作已经掌握的相当熟练了.今天,徐老师想测试一下大家对于字符 ...