zoukankan      html  css  js  c++  java
  • debian 7上源码编译MongoDB 3.4版本

    此文已由作者温正湖授权网易云社区发布。

    欢迎访问网易云社区,了解更多网易技术产品运营经验。


    要想精通一个数据库,除了知道该数据库的功能特性、使用方法等,还需要能够看懂数据库源码,能够使用gdb工具对其进行调试跟踪,如果能够修改源码,实现自己所需的功能,那是极好的。本文简单介绍如何在debian 7上编译MongoDB 3.4源码。官方的编译指南如链接所示:MongoDB编译指南。摘取如下:


    To build the master branch, you will need:
    
    A modern and complete C++11 compiler. One of the following is required:
    VS2015 Update 2 or newer
    GCC 5.3.0Clang 3.4 (or Apple XCode 5.1.1 Clang) or newer
    Python 2.7SCons 2.3.5 or newer (for MSVC 2015 support)


    Further requirements are system-dependent and for both SCons and running the tests:
    
    On Linux, you will need to install a compiler gcc or clang, as well as glibc headers which are usually included in a package named glibc-devel.
    
    On Debian and Ubuntu systems, you must install the libssl-dev package to compile with SSL support.
    On Red Hat and CentOS systems, you must install the openssl-devel package to compile with SSL support.

    之后,执行scons all 或scons mongod来根据自己的需要编译对应的可执行文件。

    但官方的参考指南过于简单,真正在编译的时候,就没有那么轻松了。下面根据在debian 7.8上的实践把无法直接通过apt安装的步骤做下简要记录:


    1、编译前,请确保所在的编译目录有不少于30G的磁盘空间;


    2、安装gcc


    wget http://ftp.gnu.org/gnu/gcc/gcc-5.3.0/gcc-5.3.0.tar.gztar -xvf gcc-5.3.0.tar.gz
    cd gcc-5.3.0./contrib/download_prerequisites
    ./configure --disable-multilib
    make
    make install


    3、安装scons,scons是使用python写的编译工具,相比makefile简单和强大很多


    wget https://sourceforge.net/projects/scons/files/scons/2.3.0/scons-2.3.0.tar.gztar -xvf scons-2.3.0.tar.gz
    cd scons-2.3.0python ./setup.py install


    4、编译MongoDB


    wget https://fastdl.mongodb.org/src/mongodb-src-r3.4.7.zipapt-get install zip
    unzip mongodb-src-r3.4.7.zip
    cd mongodb-src-r3.4.7scons all


    网易云免费体验馆,0成本体验20+款云产品! 

    更多网易技术、产品、运营经验分享请点击


    相关文章:
    【推荐】 4月第4周业务风控关注|网络犯罪经济每年1.5万亿美元GDP居全球第12位
    【推荐】 年轻设计师如何做好商业设计

  • 相关阅读:
    redhat 6安装详解
    使用pidstat查看进程资源使用情况
    (转)调优 DB2 UDB v8.1 及其数据库的最佳实践
    (转)LVS安装使用详解
    (转)[小工具] Linux下列格式化工具
    (转)zabbix3.4使用percona-monitoring-plugins监控mysql
    (转)zabbix之生产案例
    (转)CentOS7 LVM添加硬盘及扩容
    (转)计算机网络基础知识总结
    (转)网络基础之网络协议篇
  • 原文地址:https://www.cnblogs.com/zyfd/p/9816528.html
Copyright © 2011-2022 走看看