官术网_书友最值得收藏!

Installing from source

The beauty of installing MongoDB directly from its source code is that it ensures that you can run MongoDB on any server, and that you have the absolute latest version. Minimum requirements for source installation include:

In addition, there are OS-specific requirements, which are detailed in this table:

    
Linux           Compiler: GCC 4.8.2 or later
Red Hat, and suchlike.
                   
          
Libraries needed:
glibc-devel
libcurl-devel
openssl-devel
epel-release
python-devel
Ubuntu, and suchlike.
                   
          
Libraries needed:
build-essential
libffi-dev
libssl-dev
python-dev
macOSX           Compiler: Clang 3.4 of XCode 5
           Libraries: XCode (especially command line tools)
Windows           Compiler: Visual Studio 2013 Update 4 or later
It is highly recommended that you carefully read through the source installation process documentation, which can be found on github.com at this URL: https://github.com/mongodb/mongo/wiki/Build-Mongodb-From-Source.

The source build process does not follow the traditional sequence of configure, make, and make install. Installation is performed using SCons (Software Construction Tool, https://www.scons.org/), which, in turn, uses the programming language Python. Accordingly, after you clone or download the MongoDB source, you will notice many Python scripts and configuration files.

For the purposes of this illustration, we use CentOS 7. To install MongoDB from source, assuming all prerequisites listed previously are met, proceed as follows:

  1. Download the source code from github.com. There are two ways to download the MongoDB source code from github.com:
    1. Download directly from this URL:
      https://github.com/mongodb/mongo/archive/master.zip.
      You would then need to unzip it into a folder such as /home/user/mongo.
    1.  If you have installed git, you can clone the repository from a command line terminal as follows:

  1. Change to the newly created (or cloned) mongo directory.
  2. Install pip requirements:
On Windows you would need to run this command:
pip.exe install -r buildscripts\requirements.txt
  1. Build the source code using SCons:

At this point, you can then follow the same steps listed previously to run MongoDB:

  • Create a directory for the database (for example /var/lib/mongo)
  • Create a directory for the log (for example /var/log/mongo)
  • Create a config file, which indicates the locations of the database and log (for example /etc/mongod.conf)
  • Start MongoDB
主站蜘蛛池模板: 龙海市| 崇明县| 托里县| 平阳县| 自治县| 海淀区| 阿鲁科尔沁旗| 宁强县| 大余县| 安庆市| 敦化市| 孟津县| 宝丰县| 河间市| 醴陵市| 隆子县| 汽车| 保德县| 保定市| 印江| 汶川县| 峨眉山市| 封开县| 咸阳市| 邳州市| 乐至县| 鄂托克旗| 积石山| 林口县| 伽师县| 红安县| 东源县| 清水县| 盘山县| 云阳县| 攀枝花市| 滦南县| 高清| 柘城县| 广元市| 会宁县|