Docs Menu

Docs HomeDevelop ApplicationsMongoDB Manual

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

Note

MongoDB Atlas

MongoDB Atlas is a hosted MongoDB service option in the cloud which requires no installation overhead and offers a free tier to get started.

Use this tutorial to install MongoDB 7.0 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.

This tutorial installs MongoDB 7.0 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.

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.

The MongoDB Shell (mongosh) is not installed with MongoDB Server. You need to follow the mongosh installation instructions to download and install mongosh separately.

MongoDB 7.0 Enterprise Edition supports the following 64-bit versions of Windows on x86_64 architecture:

  • Windows Server 2022

  • Windows Server 2019

  • Windows 11

MongoDB only supports the 64-bit versions of these platforms.

For more information, see Platform Support.

Note

MongoDB is not supported on Windows Subsystem for Linux (WSL). To run MongoDB on Linux, use a supported Linux system.

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.

Before deploying MongoDB in a production environment, consider the Production Notes document which offers performance considerations and configuration recommendations for production MongoDB deployments.

MongoDB logs diagnostic data to assist with troubleshooting. For detailed information, see Full Time Diagnostic Data Capture.

On Windows, to collect system data such as disk, cpu, and memory, FTDC requires Microsoft access permissions from the following groups:

  • Performance Monitor Users

  • Performance Log Users

If the user running mongod and mongos is not an administrator, add them to these groups to log FTDC data. For more information, see the Microsoft documentation here.

Follow these steps to install MongoDB Enterprise Edition unattended on Windows from the Windows command prompt/interpreter (cmd.exe) using msiexec.exe.

1

Download the MongoDB Enterprise .msi installer from the following link:

MongoDB Download Center

  1. In the Version dropdown, select the version of MongoDB to download.

  2. In the Platform dropdown, select Windows.

  3. In the Package dropdown, select msi.

  4. Click Download.

2

Important

You must open the command interpreter as an Administrator.

Use the .msi installer to install all MongoDB binaries, including MongoDB Compass.

From the Command Interpreter, go to the directory containing the .msi installation binary and run:

msiexec.exe /l*v mdbinstall.log /qb /i mongodb-windows-x86_64-enterprise-7.0-signed.msi

The operation installs the binaries to the default directory C:\Program Files\MongoDB\Server\7.0\bin.

To specify a different installation location for the executables, add the INSTALLLOCATION value.

msiexec.exe /l*v mdbinstall.log /qb /i mongodb-windows-x86_64-enterprise-7.0-signed.msi ^
INSTALLLOCATION="C:\MongoDB\Server\7.0\"

To suppress the installation of MongoDB Compass, you must explicitly include the SHOULD_INSTALL_COMPASS="0" argument.

msiexec.exe /l*v mdbinstall.log /qb /i mongodb-windows-x86_64-enterprise-7.0-signed.msi ^
SHOULD_INSTALL_COMPASS="0"

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
ServerService
Set up mongod.exe as a Windows service.
Router
MonitoringTools
ImportExportTools
MiscellaneousTools
mongodecrypt.exe, mongokerberos.exe, mongoldap.exe

For example, to install the MongoDB server (mongod.exe) with the legacy mongo client and then set up the MongoDB server as a Windows service, run:

msiexec.exe /l*v mdbinstall.log /qb /i mongodb-windows-x86_64-enterprise-7.0-signed.msi ^
ADDLOCAL="ServerService,LegacyClient" ^
SHOULD_INSTALL_COMPASS="0"

To include Compass in the installs, remove SHOULD_INSTALL_COMPASS="0".

Starting in version 4.0, you can install and configure MongoDB as a Windows Service during the install, and the MongoDB service starts upon successful installation.

To start/restart the MongoDB service, use the Services console:

  1. From the Services console, locate the MongoDB service.

  2. 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:

1

Close all other command prompts, then invoke the following command:

net start MongoDB
2

Check your MongoDB log file for the following line:

[initandlisten] waiting for connections on port 27017

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.

3

If you have not already done so, follow the mongosh installation instructions to download and install the MongoDB Shell (mongosh).

Be sure to add the path to your mongosh.exe binary to your PATH environment variable during installation.

Open a new Command Interpreter and enter mongosh.exe to connect to MongoDB.

To stop/pause the MongoDB service, use the Services console:

  1. From the Services console, locate the MongoDB service.

  2. 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:

net stop MongoDB

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:

sc.exe delete MongoDB

Open a Windows command prompt/interpreter (cmd.exe) as an Administrator.

Important

You must open the command interpreter as an Administrator.

1

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:

cd C:\
md "\data\db"
2

To start MongoDB, run mongod.exe.

"C:\Program Files\MongoDB\Server\7.0\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\7.0\bin\mongod.exe from communicating on networks. To remedy this issue:

  1. Click Private Networks, such as my home or work network.

  2. Click Allow access.

To learn more about security and MongoDB, see the Security Documentation.

3

If you have not already done so, follow the mongosh installation instructions to download and install the MongoDB Shell (mongosh).

Be sure to add the path to your mongosh.exe binary to your PATH environment variable during installation.

Open a new Command Interpreter and enter mongosh.exe to connect to MongoDB.

For more information on connecting to mongod using mongosh.exe, such as connecting to a MongoDB instance running on a different host and/or port, see Connect to a Deployment.

For information on CRUD (Create, Read, Update, Delete) operations, see:

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 which is accessible from the remote clients.

This value can be configured either:

  • in the MongoDB configuration file with bindIp, or

  • via the command-line argument --bind_ip

Warning

Before you bind your instance to a publicly-accessible IP address, you must secure 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.

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.

All command-line examples in this tutorial are provided as absolute paths to the MongoDB binaries. You can add C:\Program Files\MongoDB\Server\7.0\bin to your System PATH and then omit the full path to the MongoDB binaries.

←  Install MongoDB Enterprise Edition on WindowsInstall MongoDB Enterprise with Docker →