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. C++中的友元函数和友元类

    C++中的友元函数主要应用于以下场景: 友元函数 第一种场景 代码中有一个全局函数,该函数想要去访问某个类的成员变量(该类的成员变量是private的,且该类并未提供任何获取获取私有成员变量的publ ...

  2. 【Android】事件输入系统-代码层次解读

    本文基于Android-4.0 理论层次解读 请看:www.cnblogs.com/lcw/p/3373214.html 如何管理各种驱动设备 在理论中谈到EventHub,这个一看就是一个做实事的, ...

  3. 【delphi】delphi操作sqlite3

    SQLite SQLite是一个老牌的轻量级别的本地文件数据库,完全免费且开源,不需要安装,无须任何配置,当然,这样管理功能就不是很强大了,但是它的主要应用也是在本地数据库,可以说是最简单好用的嵌入式 ...

  4. sed行处理详解(交换行,合并行,删除行等)

    1.合并行 zj@zj:~/Script/blog_script$ cat test11234合并上下两行zj@zj:~/Script/blog_script$ sed '$!N;s/\n/\t/' ...

  5. 使用 Trace 将日志输入到文件中

    工具没有好坏,只有适不适用.由于项目中用 Log4Net 过重,所以使用 Trace 代替了 Log4Net 输入一些简单的日志信息: 自定义监听文件 using System; using Syst ...

  6. java框架篇---Struts入门

    首先理解Struts与MVC的关系 在传统的MVC模式中所有的请求都要先交给Servlet处理,之后由Servlet调用JavaBean,并将结果交给JSP中进行显示.结构图如下 Struts是Apa ...

  7. 【MarkdownPad】不能输入表格Table

    使用MarkdownPad时,需要制作一个表格.搜到参照这篇文章,发现还是无法显示表格,测试效果是如下这样的: Markdown文本: 显示效果: 谷歌一下,原来是MarkdownPad默认的处理器不 ...

  8. logback的日志文件中出现大量的ESC符号

    如下图: 这个日志文件是用less命令打开的,然后看到就惊呆了,日志文件乱成这样的. 开始我以为是我把logback的配置文件弄错了,还看了半天pattern. 然后百度了一下,找了这篇博客: htt ...

  9. mongo源码学习(一)

    在git上把mongo的源码给拉下来了,然后目录大概是这样的: 这个mongo是用C++写的,编译并没有用Makefile而是用的scons工具,这个好像是python写的. mongo后台进程的入口 ...

  10. IIS7 https 发生413错误 未显示页面,因为请求实体过大

    参考文档:     http://msdn.microsoft.com/zh-cn/library/cc737382(v=ws.10).aspx http://www.java123.net/v/12 ...