Reference official website https://docs.mongodb.com/manual/tutorial/install-mongodb-on-red-hat/
First, installation
1. Configuring the Yum Management Pack
1), create the file under Path/etc/yum.repos.d/Mongodb-org-3.4.repo
cd/etc/yum.repos.d/
Touch Mongodb-org-3.4.repo
2), write the following in the file Mongodb-org-3.4.repo
[mongodb-org-3.4]
Name=MongoDB Repository
BaseURL=https://repo.mongodb.org/yum/redhat/$releasever/mongodb-org/3.4/x86_64/
Gpgcheck=1
Enable=1
Gpgkey=https://www.mongodb.org/static/pgp/server-3.4.asc
2. Install MongoDB (Install mongodb-org package and its dependent packageMongodb-org-server,Mongodb-org-mongos,Mongodb-org-shell,mongodb-org-tools )
< Span class= "s" > db instance default in/var/lib/mongo path, log default in/var/log/ MongoDB path, you can also configure by modifying the Storage.dbpath and Systemlog.path of the/etc/mongod.conf file
Yum Install-y mongodb-org
3. Open MongoDB Service
Service Mongod Start
4, check the log mode, verify that the service opened successfully, which has a behavior: [Thread1] waiting for connections on port 27017
Cat/var/log/mongodb/mongod.log
5. Set Boot start
Chkconfig Mongod on
6. Stop MongoDB Service
Service Mongod Stop
7. Restart MongoDB Service
Service Mongod Restart
Second, uninstall
1. Stop the Service
Service Mongod Stop
2. Remove Installed Packages
Yum Erase $ (rpm-qa | grep mongodb-org)
3. Delete data and logs
Rm-r/var/log/mongodb
Rm-r/var/lib/mongo
CentOS7 on MongoDB Install, uninstall