Install MongoDB On Windows
To install the MongoDB on windows, first download the latest release of MongoDB from http://www.mongodb.org/downloads Make sure you get correct version of MongoDB depending upon your windows version. To get your windows version open command prompt and execute following command.
Microsoft Windows [Version 6.1.7601]
Copyright (c) 2009 Microsoft Corporation. All rights reserved.
C:\MongoDB\bin>wmic os get osarchitecture
OSArchitecture
64-bit
Install MongoDB for Windows.
Change to the directory containing the .msi installation binary of your choice and invoke:
Directory of C:\MongoDB
03/29/2016 04:40 PM <DIR> .
03/29/2016 04:40 PM <DIR> ..
03/29/2016 04:38 PM 97,922,560 mongodb-win32-x86_64-3.2.4-signed.msi
1 File(s) 97,922,560 bytes
2 Dir(s) 43,619,405,824 bytes free
C:\MongoDB>msiexec.exe /q /i mongodb-win32-x86_64-3.2.4-signed.msi INSTALLLOCATION="C:\MongoDB" ADDLOCAL="all"
C:\MongoDB>
Configure a Windows Service for MongoDB Community Edition
Open an Administrator command prompt.
Press the Win key, type cmd.exe, and press Ctrl + Shift + Enter to run the Command Prompt as Administrator.
Execute the remaining steps from the Administrator command prompt.
Create directories.
Create directories for your database and log files:
mkdir c:\data\db
mkdir c:\data\log
3
Create a configuration file.
Create a configuration file. The file must set systemLog.path. Include additional configuration options as appropriate.
For example, create a file at C:\mongodb\mongod.cfg that specifies both systemLog.path and storage.dbPath:
C:\MongoDB\bin>notepad C:\mongodb\mongod.cfg
systemLog:
destination: file
path: c:\data\log\mongod.log
storage:
dbPath: c:\data\db
Install the MongoDB service.
IMPORTANT
Run all of the following commands in Command Prompt with “Administrative Privileges”.
Install the MongoDB service by starting mongod.exe with the --install option and the -config option to specify the previously created configuration file.
C:\MongoDB\bin>mongod.exe --config "C:\mongodb\mongod.cfg" --install
C:\MongoDB\bin>
To use an alternate dbpath, specify the path in the configuration file (e.g. C:\mongodb\mongod.cfg) or on the command line with the --dbpath option.
Start the MongoDB service.
C:\MongoDB\bin>net start MongoDB
The MongoDB service was started successfully.
C:\MongoDB\bin>
To install the MongoDB on windows, first download the latest release of MongoDB from http://www.mongodb.org/downloads Make sure you get correct version of MongoDB depending upon your windows version. To get your windows version open command prompt and execute following command.
Microsoft Windows [Version 6.1.7601]
Copyright (c) 2009 Microsoft Corporation. All rights reserved.
C:\MongoDB\bin>wmic os get osarchitecture
OSArchitecture
64-bit
Install MongoDB for Windows.
Change to the directory containing the .msi installation binary of your choice and invoke:
Directory of C:\MongoDB
03/29/2016 04:40 PM <DIR> .
03/29/2016 04:40 PM <DIR> ..
03/29/2016 04:38 PM 97,922,560 mongodb-win32-x86_64-3.2.4-signed.msi
1 File(s) 97,922,560 bytes
2 Dir(s) 43,619,405,824 bytes free
C:\MongoDB>msiexec.exe /q /i mongodb-win32-x86_64-3.2.4-signed.msi INSTALLLOCATION="C:\MongoDB" ADDLOCAL="all"
C:\MongoDB>
Configure a Windows Service for MongoDB Community Edition
Open an Administrator command prompt.
Press the Win key, type cmd.exe, and press Ctrl + Shift + Enter to run the Command Prompt as Administrator.
Execute the remaining steps from the Administrator command prompt.
Create directories.
Create directories for your database and log files:
mkdir c:\data\db
mkdir c:\data\log
3
Create a configuration file.
Create a configuration file. The file must set systemLog.path. Include additional configuration options as appropriate.
For example, create a file at C:\mongodb\mongod.cfg that specifies both systemLog.path and storage.dbPath:
C:\MongoDB\bin>notepad C:\mongodb\mongod.cfg
systemLog:
destination: file
path: c:\data\log\mongod.log
storage:
dbPath: c:\data\db
Install the MongoDB service.
IMPORTANT
Run all of the following commands in Command Prompt with “Administrative Privileges”.
Install the MongoDB service by starting mongod.exe with the --install option and the -config option to specify the previously created configuration file.
C:\MongoDB\bin>mongod.exe --config "C:\mongodb\mongod.cfg" --install
C:\MongoDB\bin>
To use an alternate dbpath, specify the path in the configuration file (e.g. C:\mongodb\mongod.cfg) or on the command line with the --dbpath option.
Start the MongoDB service.
C:\MongoDB\bin>net start MongoDB
The MongoDB service was started successfully.
C:\MongoDB\bin>