- MongoDB 4 Quick Start Guide
- Doug Bierer
- 395字
- 2021-08-13 15:25:02
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:
- A modern C++ 11 compiler
- Python (https://www.python.org/) 2.7 or above
- pip (https://pypi.org/project/pip/, tool for installing python packages)
- git (https://git-scm.com/, recommended)
In addition, there are OS-specific requirements, which are detailed in this table:
Linux Compiler: GCC 4.8.2 or later
Libraries needed:
glibc-devel
libcurl-devel
openssl-devel
epel-release
python-devel
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
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:
- Download the source code from github.com. There are two ways to download the MongoDB source code from github.com:
- 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.
- Download directly from this URL:
-
- If you have installed git, you can clone the repository from a command line terminal as follows:
- Change to the newly created (or cloned) mongo directory.
- Install pip requirements:

pip.exe install -r buildscripts\requirements.txt
- 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
- 輕松學(xué)C語(yǔ)言
- 輕松學(xué)C#
- 計(jì)算機(jī)原理
- 工業(yè)機(jī)器人工程應(yīng)用虛擬仿真教程:MotoSim EG-VRC
- 可編程控制器技術(shù)應(yīng)用(西門(mén)子S7系列)
- 21天學(xué)通C#
- PyTorch Deep Learning Hands-On
- Windows 7寶典
- PVCBOT機(jī)器人控制技術(shù)入門(mén)
- 從零開(kāi)始學(xué)SQL Server
- 電氣控制與PLC原理及應(yīng)用(歐姆龍機(jī)型)
- C++程序設(shè)計(jì)基礎(chǔ)(上)
- 深度學(xué)習(xí)原理與 TensorFlow實(shí)踐
- 網(wǎng)頁(yè)設(shè)計(jì)與制作
- 基于元胞自動(dòng)機(jī)的人群疏散系統(tǒng)建模與分析