1. Environment readiness, XP system not supported, need to be installed on Windows7 and above and on Windows Server 2008 system.
2. Download the installation package: http://www.mongodb.org/downloads, download the corresponding installation package according to the environment.
3. When the download is complete, double-click Run, the default installation directory is C:\Program FILES\MONGODB 2.6 standard
4. (Can omit) add the installation directory to the environment variable, so you do not need to specify the running directory when you run the command
Computer right--Advanced system design-environment variable-path, followed by path C:\Program FILES\MONGODB 2.6 standard\bin
Note: If you omit this step, you need to specify the run directory as C:\Program files\mongodb 2.6 standard\bin When executing the command below.
5. In order to run MongoDB, you need to create the data folder and the log folder, manually create the E:\mongodb\data and E:\mongodb\log directories
Can also be created with cmd: mkdir e:\mongodb\data, mkdir e:\mongodb\data
6. Cmd to run Mongod.exe, you can start the MONGDB service, you need to specify--dbpath to Mongod.exe at startup:
Mongod.exe--dbpath E:\mongodb\data, the result of the operation is as follows, showing the startup success.
7. Link Test: Open cmd, run Mongo.exe, display such as MongoDB can connect, MongoDB configuration complete
If you do not start the Mongod.exe service, you will get an error connecting to MongoDB:
Two: Configure the service
For MongoDB to be easy to use, we can create system services for MongoDB (in version 2.6 We also need to create the service manually) so that we do not need to manually start.
1. Create the configuration file Mongod.cfg in the installation directory file, which is any specified path
The content is written on:
Logpath=e:\mongodb\log\mongo.log
Dbpath=e:\mongodb\data
You can also create by using cmd:
Echo LogPath = "E:\MongoDB\log\mongo.log" > "C:\Program files\mongodb 2.6 standard\mongod.cfg"
echo dbpath="E:\MongoDB\data">>"C:\Program files\mongodb 2.6 Standard\mongod.cfg "
To create a service using a command:
Mongod--config "C:\Program files\mongodb 2.6 standard\mongod.cfg"--install
or system services to create the service:
Sc.exe Create MongoDB binpath= "C:\Program files\mongodb 2.6 standard\bin\mongod.exe\"--service--config=\ "C:\Program FILES\MONGODB 2.6 standard\mongod.cfg\ "" displayname= "MongoDB 2.6 standard" start= "Auto"
Execution succeeds, service creation succeeds, input services.msc in cmd, open system service, can see MongoDB service already exists, right-click Start can use MongoDB. You can also pass
Net Start MongoDB to start the service
net stop MongoDB to shut down the service
The installation is complete and the service is configured successfully. CMD, enter Mongo.exe to test the connection success.
http://docs.mongodb.org/manual/tutorial/install-mongodb-on-windows/connection for more detailed information.