This document describes how to install MongoDB under CentOS 6 or 7 x64.
1. Configuration package Management System (YUM)
Take the MongoDB 3.6 version as an example
Create a/etc/yum.repos.d/mongodb-org-3.6.repo file to install MongoDB directly using Yum;
The Enterprise Edition is/etc/yum.repos.d/mongodb-enterprise.repo.
The contents of the file are as follows:
A. Community version
[mongodb-org-3.6== https://11= HTTPS:// WWW.MONGODB.ORG/STATIC/PGP/SERVER-3.6.ASC
B. Enterprise version
[mongodb-== https://11= https:// WWW.MONGODB.ORG/STATIC/PGP/SERVER-3.6.ASC
If you need other versions to find other versions on the MongoDB website, modify the version number of the repo file, where the odd version is the development version and is not recommended for production use.
2. Installing MongoDB
sudo Yum Install -y mongodb-org
To install a specific version of MongoDB, specify each component package separately and append the version number to the package name, as shown in the following example:
sudo Yum Install -y mongodb-org-3.6. 2 mongodb-org-server-3.6. 2 mongodb-org-shell-3.6. 2 mongodb-org-mongos-3.6. 2 mongodb-org-tools-3.6. 2
If a version is specified, in order to prevent accidental escalation, you can add the following information in/etc/yum.conf:
Exclude = Mongodb-org,mongodb-org-server,mongodb-org-shell,mongodb-org-mongos,mongodb-org-tools
MongoDB Start command
sudo service mongod start
MongoDB End Command
sudo service mongod stop
MongoDB Restart command
sudo service mongod restart
Reference Documentation:
Official Document: https://docs.mongodb.com/master/tutorial/install-mongodb-on-red-hat/
Installing MongoDB under CentOS