use this tutorial to install mongodb community edition on windows systems.
platform support
starting in version 2.2, mongodb does not support windows xp. please use a more recent version of windows to use more recent releases of mongodb.
important
mongodb community edition requires windows server 2008 r2, windows vista, or later. the .msi installer includes all other software dependencies and will automatically upgrade any older version of mongodb installed using an .msi file.
1
there are three builds of mongodb for windows:
mongodb for windows 64-bit runs only on windows server 2008 r2, windows 7 64-bit, and newer versions of windows. this build takes advantage of recent enhancements to the windows platform and cannot operate on older versions of windows.
mongodb for windows 32-bit runs on any 32-bit version of windows newer than windows vista. 32-bit versions of mongodb are only intended for older systems and for use in testing and development systems. 32-bit versions of mongodb only support databases smaller than 2gb.
note
starting in mongodb 3.2, 32-bit binaries are deprecated and will be unavailable in future releases.
mongodb for windows 64-bit legacy runs on windows vista, windows server 2003, and windows server 2008 and does not include recent performance enhancements.
to find which version of windows you are running, enter the following commands in the command prompt or powershell:
2
in windows explorer, locate the downloaded mongodb .msi file, which typically is located in the default downloads folder. double-click the .msi file. a set of screens will appear to guide you through the installation process.
you may specify an installation directory if you choose the “custom” installation option.
these instructions assume that you have installed mongodb to c:\mongodb.
mongodb is self-contained and does not have any other system dependencies. you can run mongodb from any folder you choose. you may install mongodb in any folder (e.g. d:\test\mongodb).
you may install mongodb community unattended on windows from the command line using msiexec.exe.
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.
change to the directory containing the .msi installation binary of your choice and invoke:
you can specify the installation location for the executable by modifying the installlocation value.
by default, this method installs all mongodb binaries. to install specific mongodb component sets, you can specify them in the addlocal argument using a comma-separated list including one or more of the following component sets:
component set
binaries
server
mongod.exe
router
mongos.exe
client
mongo.exe
monitoringtools
mongostat.exe, mongotop.exe
importexporttools
mongodump.exe, mongorestore.exe, mongoexport.exe, mongoimport.exe
miscellaneoustools
bsondump.exe, mongofiles.exe, mongooplog.exe, mongoperf.exe
for instance, to install only the mongodb utilities, invoke:
warning
if your path includes spaces, enclose the entire path in double quotes, for example:
3
4
create directories for your database and log files:
run all of the following commands in command prompt with “administrative privileges”.
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.
5
6
to stop the mongodb service use the following command:
to remove the mongodb service use the following command:
you can set up the mongodb server as a windows service that starts automatically at boot time.
the following procedure assumes you have installed mongodb community using the .msi installer with the path c:\mongodb\.
if you have installed in an alternative directory, you will need to adjust the paths as appropriate.
create the mongodb service.
sc.exe requires a space between “=” and the configuration values (eg “binpath= ”), and a “\” to escape double quotes.
if successfully created, the following log message will display:
to stop the mongodb service, use the following command:
to remove the mongodb service, first stop the service and then run the following command:
<a target="_blank" href="https://university.mongodb.com/courses/m101p/about?jmp=docs">mongodb for developers free course</a>
<a target="_blank" href="https://university.mongodb.com/courses/m101n/about?jmp=docs">mongodb for .net developers free online course</a>
<a target="_blank" href="https://www.mongodb.com/lp/white-paper/architecture-guide?jmp=docs">mongodb architecture guide</a>