- Install MongoDB >
- Install MongoDB Enterprise >
- Install MongoDB Enterprise Edition on Windows >
- Install MongoDB Enterprise on Windows using
msiexec.exe
Install MongoDB Enterprise on Windows using msiexec.exe
¶
On this page
- Overview
- Considerations
- Install MongoDB Enterprise Edition
- Start MongoDB Enterprise Edition as a Windows Service
- Stop MongoDB Enterprise Edition as a Windows Service
- Remove MongoDB Enterprise Edition as a Windows Service
- Start MongoDB Enterprise Edition from the Command Interpreter
- Additional Considerations
MongoDB Atlas
Overview¶
Use this tutorial to install MongoDB 4.2 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 4.2 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 using the command-line tool
msiexec.exe
. To install MongoDB using the graphical MSI Installer
instead, see Install MongoDB using the MSI Installer.
Considerations¶
Platform Support¶
MongoDB 4.2 Enterprise Edition supports the following 64-bit versions of Windows on x86_64 architecture:
- Windows Server 2019
- 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.
Note
MongoDB is not supported on Windows Subsystem for Linux (WSL). To run MongoDB on Linux, use a supported Linux system.
Virtualization¶
Oracle offers experimental support for VirtualBox on Windows hosts where Hyper-V is running. However, Microsoft does not support VirtualBox on Hyper-V.
Disable Hyper-V if you want to install MongoDB on Windows using VirtualBox.
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.
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.¶
Download the MongoDB Enterprise .msi
installer from the following
link:
- In the Version dropdown, select the version of MongoDB to download.
- In the Platform dropdown, select Windows.
- In the Package dropdown, select msi.
- Click Download.
Run the Windows Installer from the Windows Command Interpreter.¶
Important
You must open the command interpreter as an Administrator.
- Windows 8 or greater
- Windows 7
For Windows 8 or greater, you can use the .msi
to
install all MongoDB binaries, including MongoDB Compass.
From the Command Interpreter, go to the directory containing the
.msi
installation binary and run:
The operation installs the binaries to the default directory
C:\Program Files\MongoDB\Server\4.2\bin
.
To specify a different installation location for the executables,
add the INSTALLLOCATION
value.
To suppress the installation of MongoDB
Compass, you must explicitly include the
SHOULD_INSTALL_COMPASS="0"
argument.
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 Name | Binaries Included in the Component Set |
---|---|
ServerNoService |
mongod.exe |
ServerService |
Set up mongod.exe as a Windows service. |
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 |
For example, to install just the MongoDB server
(mongod.exe
) and the mongo.exe
shell as well as
set up the MongoDB server as a Windows service, run:
To include Compass in the installs, remove SHOULD_INSTALL_COMPASS="0"
.
For Windows 7, you can use the .msi
to install all
MongoDB binaries except MongoDB Compass since the
.msi
installer requires PowerShell version 3.0 or
greater to install Compass. You can manually install
Compass from the Download Center.
From the Command Interpreter, go to the directory
containing the .msi
and run the following command:
Note
The command includes the SHOULD_INSTALL_COMPASS="0"
argument to suppress the installation of MongoDB
Compass.
The operation installs the binaries to the default directory
C:\Program Files\MongoDB\Server\4.2\bin
.
To specify a different installation location for the executables,
add the INSTALLLOCATION
value.
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 |
---|---|
ServerNoService |
mongod.exe |
ServerService |
Set up mongod.exe as a Windows service. |
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 |
For example, to install just the MongoDB server
(mongod.exe
) and the mongo.exe
shell as well as
set up the MongoDB server as a Windows service, run:
Start MongoDB Enterprise Edition as a Windows Service¶
Starting in version 4.0, you can install and configure MongoDB as a Windows Service during the install, and the MongoDB service is started upon successful installation.
To start/restart the MongoDB service, use the Services console:
- From the Services console, locate the MongoDB service.
- Right-click on the MongoDB service and click Start.
You can also manually manage the service from the command line. To
start the MongoDB service from the command line, open a Windows
command prompt/interpreter (cmd.exe
) as an Administrator, and
run the following command:
Start the MongoDB service.¶
Close all other command prompts, then invoke the following command:
Verify that MongoDB has started successfully.¶
Check your MongoDB log file for the following line:
You may see non-critical warnings in the process output. As long as you see this message in the MongoDB log, you can safely ignore these warnings during your initial evaluation of MongoDB.
Stop MongoDB Enterprise Edition as a Windows Service¶
To stop/pause the MongoDB service, use the Services console:
- From the Services console, locate the MongoDB service.
- Right-click on the MongoDB service and click Stop (or Pause).
You can also manage the service from the command line. To stop the
MongoDB service from the command line, open a Windows command
prompt/interpreter (cmd.exe
) as an Administrator, and
run the following command:
Remove MongoDB Enterprise Edition as a Windows Service¶
To remove the MongoDB service, first use the Services console to stop
the service. Then open a Windows command prompt/interpreter (cmd.exe
) as an Administrator, and
run the following command:
Start MongoDB Enterprise Edition from the Command Interpreter¶
Open a Windows command prompt/interpreter (cmd.exe
) as an Administrator.
Important
You must open the command interpreter as an Administrator.
Create 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 directories:
Start your MongoDB database.¶
To start MongoDB, run mongod.exe
.
The --dbpath
option points to your
database directory.
If the MongoDB database server is running correctly, the Command Interpreter displays:
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\4.2\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:
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:
Additional Considerations¶
Localhost Binding by Default¶
By default, MongoDB launches with bindIp
set to
127.0.0.1
, which binds to the localhost network interface. This
means that the mongod.exe
can only accept connections from
clients that are running on the same machine. Remote clients will not be
able to connect to the mongod.exe
, and the mongod.exe
will
not be able to initialize a replica set unless this value is set
to a valid network interface.
This value can be configured either:
Warning
Before binding to a non-localhost (e.g. publicly accessible) IP address, ensure you have secured your cluster from unauthorized access. For a complete list of security recommendations, see Security Checklist. At minimum, consider enabling authentication and hardening network infrastructure.
For more information on configuring bindIp
, see
IP Binding.
Point Releases and .msi
¶
If you installed MongoDB with the Windows installer (.msi
), the
.msi
automatically upgrades within the same release series (e.g. 4.2.1 to 4.2.2).
Upgrading a full release series (e.g. 4.0 to 4.2) requires a new installation.
Add MongoDB binaries to the System PATH¶
All command-line examples in this tutorial are provided as absolute
paths to the MongoDB binaries. You can add C:\Program
Files\MongoDB\Server\4.2\bin
to your System PATH
and then
omit the full path to the MongoDB binaries.