1. Download
Address: Http://www.mongodb.org/downloads (32-bit or 64-bit choice).
I downloaded: mongodb-win32-x86_64-2.4.5.zip
2. Decompression
Put the mongodb-win32-x86_64-2.4.5.zip in one place and unzip it. I put it in the D:\dev directory.
The path after decompression is D:\dev\mongodb-win32-x86_64-2.4.5
3. Installation Preparation
The default data directory for MongoDB is: C:\data\db. If you do not use the default directory, you need to add the--dbpath parameter after the Mongod.exe command.
Create a Data Catalog. I created a D:\dev\mongodb-win32-x86_64-2.4.5\data\db.
Create the log directory and its files. I created D:\dev\mongodb-win32-x86_64-2.4.5\log and D:\dev\mongodb-win32-x86_64-2.4.5\log\log.txt.
4. Start MongoDB
Open cmd window (cmd.exe), enter D:\dev\mongodb-win32-x86_64-2.4.5\bin, execute Mongod.exe command, see.
Mongod.exe--logpath=d:\dev\mongodb-win32-x86_64-2.4.5\log\log.txt--dbpath=d:\dev\mongodb-win32-x86_64-2.4.5\ Data\db
The--logpath parameter is the path to the set log file.
The--dbpath parameter is the set path for the database file.
All parameter options for the Mongod.exe command can be viewed through Mongod.exe--help.
5. Install as a service
Open the Windows CMD window with administrator privileges and enter the D:\dev\mongodb-win32-x86_64-2.4.5\bin directory.
Mongod.exe--install--logpath=d:\dev\mongodb-win32-x86_64-2.4.5\log\log.txt--dbpath=d:\dev\mongodb-win32-x86_ 64-2.4.5\data\db
The--install parameter is set to install as a server
Once set as a service, you can start or stop MongoDB in the form of a service by using the cmd ( Windows CMD window with Administrator privileges open ) window.
net start MongoDB start MongoDB Service
net stop MongoDB start MongoDB service
6. Enter the shell environment interface
Enter the Sheelmongodb, enter the D:\dev\mongodb-win32-x86_64-2.4.5\bin directory in the cmd window, input mongo.exe, you can enter the shell environment interface.
Installing MongoDB under Windows7