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. 每日英语:The Power of Parents Who Say 'No'

    I grew up in an affluent area. Most kids owned multiple Cabbage Patch dolls and Gear bags and pairs ...

  2. python(51):Python vars() 函数

    Python vars() 函数  Python 内置函数 描述 vars() 函数返回对象object的属性和属性值的字典对象. 语法 vars() 函数语法: vars([object]) 参数 ...

  3. 【Java Concurrency】sleep()、wait()、notify()、notifyAll()的用法与区别

    >关于本文 本文介绍sleep().wait().notify().notifyAll()方法,主要要理解: sleep()和wait()的区别. wait()与notify().notifyA ...

  4. linux远程拷贝命令-scp

    因为某种原因需要远程一个CentOS主机,只能通过ssh访问并下载文件.搞了半天不知道怎么处理文件,比如上传和下载.那就学习下吧. 基本命令格式 由于使用ssh,登录之后的本机地址是不需要给出的.但是 ...

  5. 【转】更改 shell 终端的默认键绑定为 vi 模式

    我们使用的 shell 终端是 bash,它的默认键绑定方式是 emacs 模式.比如键入 Ctrl+a 光标会停在行首,Ctrl+e 光标会停在行尾等等. 如果希望在终端输入时使用 vi 的模式,比 ...

  6. 豆瓣源安装requirements.txt

    豆瓣源安装requirements.txt pip install -i https://pypi.doubanio.com/simple/ -r requirements.txt

  7. RTX基础教程目录

    以下RTX教程转载自安富莱电子论坛: http://forum.armfly.com/forum.php?mod=viewthread&tid=16909&extra=page%3D1 ...

  8. phalcon无限重定向

    问题 换了个新电脑,后来重新配置phalcon环境.由于用得是windows,而且还用得是2.0.5得版本,官网已经没提供这个版本下载了.而旧电脑已经被格式化了,

  9. java将图片转换成二进制

    package com.oumyye.图片; import java.awt.image.BufferedImage; import java.io.ByteArrayInputStream; imp ...

  10. 未能加载文件或程序集“System.Web.Mvc, Version=3.0.0.0,

    直接下载安装 ASP.NET MVC 3.0就可以了