1. First download the Community edition from Https://www.mongodb.com/download-center#community, and the Enterprise Edition is similar.
2. Double-click to run the installation, you can customize the installation path, which takes the default path (C:\Program files\mongodb\server\3.4)
The next step until the installation is complete.
3. Create a data storage directory (here I put in D:\MongoDB\data).
D:\MongoDB\data creates the DB directory and log directory, which are used to store database files and logs files, respectively.
4. Create the configuration file Mongod.cfg in the D:\MongoDB directory.
Systemlog: destination:file path:d:\mongodb\data\log\mongod.logstorage: dbpath:d:\mongodb\data\db
For more configuration, please see the official documentation: https://docs.mongodb.com
5. Run the command prompt as administrator (otherwise you will not have permission to create and enable Windows Services):
Start= "Auto"
net start MongoDB
PS: The command to delete the MongoDB Windows service is:SC delete MongoDB
At this point, the MongoDB for Windows Service is installed.
During use, you may encounter the following error:
1. Unable to create another system semaphore.
Just go to the MongoDB database directory ( For example, D:\MongoDB\data\db), delete the Mongod.lock under this folder, and restart the MongoDB service.
This document is referenced from:
https://docs.mongodb.com/manual/tutorial/install-mongodb-on-windows/# Configure-a-windows-service-for-mongodb-community-edition
Http://www.cnblogs.com/wangqiideal/p/6110073.html
MongoDB 3.4 Installation runs in Windows service mode