On this page
Install MongoDB Enterprise on Windows using msiexec.exe
On this page
- Overview
- Considerations
- Install MongoDB Enterprise Edition
- Start MongoDB Enterprise Edition from the Command Interpreter
- Start MongoDB Enterprise Edition as a Windows Service
- Stop MongoDB Enterprise Edition as a Windows Service
- Remove MongoDB Enterprise Edition as a Windows Service
- Additional Considerations
Overview
Use this tutorial to install MongoDB 3.6 Enterprise Edition on Windows in an unattended fashion using msiexec.exe
from the command line. This is useful for system administrators who wish to deploy MongoDB using automation.
MongoDB Enterprise Edition is available on select platforms and contains support for several features related to security and monitoring.
MongoDB Version
This tutorial installs MongoDB 3.6 Enterprise Edition. To install a different version of MongoDB Enterprise, use the version drop-down menu in the upper-left corner of this page to select the documentation for that version.
Installation Method
This tutorial installs MongoDB on Windows in an unattended fashion using msiexec.exe
. Alternatively, you may chose to install MongoDB on Windows using the default installation wizard.
➤ See Install MongoDB Enterprise Edition on Windows for instructions.
Considerations
Platform Support
MongoDB 3.6 Enterprise Edition supports the following 64-bit versions of Windows on x86_64 architecture:
- Windows 10 / Windows Server 2016
- Windows 8.1 / Windows Server 2012 R2
- Windows 8 / Windows Server 2012
- Windows 7 / Windows Server 2008 R2
MongoDB only supports the 64-bit versions of these platforms.
See Supported Platforms for more information.
Production Notes
Before deploying MongoDB in a production environment, consider the Production Notes document which offers performance considerations and configuration recommendations for production MongoDB deployments.
Show All File Name Extensions
Make certain that you set Windows Explorer to show file name extensions for all file types. This can prevent issues where the file type displayed to the user differs from the actual file type.
Example
If Windows Explorer has known file extensions hidden, what may appear to be mongod.cfg
is actually mongod.cfg.txt
.
Use Command Interpreter, not Powershell
Every time this tutorial refers to the command line, you should use the Windows command interpreter (cmd.exe
) with Administrative privileges. Not all commands work in Powershell.
To start cmd.exe
with Administrative privileges:
-
- Press the windows icon key.
- Click on the Start windows icon icon at the left end of the taskbar.
Type
cmd.exe
in the search box.Press Ctrl + Shift + Enter.
This starts the Command Prompt as the Administrator user.
Install MongoDB Enterprise Edition
Prerequisites
Users on Windows versions previous to Windows 10 must install the following update before installing MongoDB:
➤ Update for Universal C Runtime for Windows
Users on Windows 10, Server 2016 and Server 2019 do not need this update.
Procedure
Follow these steps to install MongoDB Enterprise Edition unattended on Windows from the Windows command prompt/interpreter (cmd.exe
) using msiexec.exe
.
Download MongoDB Enterprise Edition.
- Open a web browser and visit the MongoDB Download Center .
- The Download Center should display MongoDB Enterprise Server tab. If not, select Server, then click the MongoDB Enterprise Server tab.
- In the Version dropdown, select the version that corresponds to MongoDB Server 3.6. The download center always displays the latest available point version. For older point releases, click Archived releases in the right hand navigation box.
- In the OS dropdown, verify that
Windows 64-bit X64
is selected. - In the Package drop down, verify that
MSI
is selected. - Click Download.
Run the Windows Installer from the Windows Command Interpreter.
Change to the directory containing the .msi
installation binary and invoke:
msiexec.exe /q /i mongodb-win32-x86_64-enterprise-windows-64-3.6.19-signed.msi
To specify a different installation location for the executables, add the INSTALLLOCATION
value.
msiexec.exe /q /i mongodb-win32-x86_64-enterprise-windows-64-3.6.19-signed.msi ^
INSTALLLOCATION="C:\MongoDB\Server\3.6\"
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 , mongoperf.exe |
Example
To install only the MongoDB utilities, invoke:
msiexec.exe /q /i mongodb-win32-x86_64-enterprise-windows-64-3.6.19-signed.msi ^
ADDLOCAL="MonitoringTools,ImportExportTools,MiscellaneousTools"
If you do not wish to install MongoDB Compass at this time, include the SHOULD_INSTALL_COMPASS="0"
argument.
msiexec.exe /q /i mongodb-win32-x86_64-enterprise-windows-64-3.6.19-signed.msi ^
SHOULD_INSTALL_COMPASS="0"
Start MongoDB Enterprise Edition from the Command Interpreter
Create the database directory.
Create the data directory where MongoDB stores data. MongoDB’s default data directory path is the absolute path \data\db
on the drive from which you start MongoDB.
From the Command Interpreter, create the data directory:
cd C:\
md "\data\db"
Start your MongoDB database.
To start MongoDB, invoke mongod.exe
.
"C:\Program Files\MongoDB\Server\3.6\bin\mongod.exe" --dbpath="c:\data\db"
The --dbpath
option points to your database directory.
If the MongoDB database server is running correctly, the Command Interpreter displays:
[initandlisten] waiting for connections
Important
Depending on the Windows Defender Firewall settings on your Windows host, Windows may display a Security Alert dialog box about blocking “some features” of C:\Program Files\MongoDB\Server\3.6\bin\mongod.exe
from communicating on networks. To remedy this issue:
- Click Private Networks, such as my home or work network.
- Click Allow access.
To learn more about security and MongoDB, see the Security Documentation.
Connect to MongoDB.
To connect a mongo.exe
shell to the MongoDB instance, open another Command Interpreter with Administrative privileges and run:
"C:\Program Files\MongoDB\Server\3.6\bin\mongo.exe"
For more information on connecting a mongo.exe
shell, such as to connect to a MongoDB instance running on a different host and/or port, see The mongo Shell. For information on CRUD (Create,Read,Update,Delete) operations, see MongoDB CRUD Operations.
To help you start using MongoDB, MongoDB provides Getting Started Guides in various driver editions. See Getting Started for the available editions.
Start MongoDB Enterprise Edition as a Windows Service
You can set up the MongoDB server as a Windows Service that starts automatically at boot time.