简介
mongoc是MongoDB的C语言驱动
下载解压并配置
$ wget https://github.com/MongoDB/mongo-c-driver/releases/download/1.6.3/mongo-c-driver-1.6.3.tar.gz
$ tar xzf mongo-c-driver-1.6.3.tar.gz
$ cd mongo-c-driver-1.6.3
$ ./configure --disable-automatic-init-and-cleanup
如果配置成功会显示如下:
libmongoc 1.6.3 was configured with the following options:
Build configuration:
Enable debugging (slow) : no
Compile with debug symbols(slow) : no
Enable GCC buildoptimization : yes
Enable automatic init andcleanup : no
Enable maintainer flags : no
Code coverage support : no
Cross Compiling : no
Fast counters : no
Shared memory performancecounters : yes
SASL :no
SSL :no
Libbson : bundled
Documentation:
man :no
HTML :no
编译安装mongodb驱动
$make //编译
$sudo make install //安装命令
安装完成可以在
/usr/local/include 目录看到相应的.h文件
/usr/local/lib 目录看到相应的*.so*等文件
安装mongodb
$curl -O https://fastdl.mongodb.org/linux/mongodb-linux-x86_64-3.0.6.tgz # 下载
$tar -zxvf mongodb-linux-x86_64-3.0.6.tgz # 解压
$mv mongodb-linux-x86_64-3.0.6/ /usr/local/mongodb # 将解压包拷贝到指定目录
创建数据库目录,启动服务