As we discuss how to install MongoDB 4.2 on Redhat /Centos 7 in our previous Article How To Install MongoDB 4.2 on RedHat/ CentOS 7 systems, we will discuss in this one How to install MongoDB Community Edition 4.2 4.2 on Windows system using:
- the MongoDB installation wizard
- the msiexec.exe from the command line (cmd.exe)
- Installation MongoDB 4.2 using the MongoDB Installer wizard:
As we can see, installing MongoDB using the MongoDB installation wizard is pretty easy. The pre-requisites of the installation are a Windows system as a supported platform and the MongoDB installer.
Let’s check the supported platforms for the system windows, MongoDB requires x86-64 architecture and supports the following platform:
- Windows 7/Server 2008 R2
- Windows 8/2012 R2 and later
Let’s check the Official MongoDB downloads section to download the MongoDB installer to run the installer:
As we can see above, we can choose the MongoDB version, The Os and the package to download as two formats ZIP format or MSI format.
Let’s start so our Interactive installation on our system windows 8:
Once the downloading of the installer file mongodb-win32-x86_64-2012plus-4.2.2-signed.msi is completing, we initiate the installation process:
Click Next on the screen above and after we accept the terms in the License Agreement’ checkbox:
Click on the button Next to progress further, we have to choose between ‘Complete’ and ‘Custom’ installation:
If we need to choose which programs feature will be installed and where will be installed, it is possible with the custom choice installation:
Considering that we’ve chosen to go by the recommended setup option of ‘Complete’ that will install MongoDB and the MongoDB tools to the default location.
Starting in MongoDB 4.0, the installation process gives us the choice to install just the MongoDB binaries or to set up MongoDB as a Windows service during the install:
In the below screen it appears to trigger the actual installation process by clicking on the Install button:
Since we install and configure MongoDB as a Windows Service during the install, the MongoDB service is started upon successful installation.
After installation, we can check our install directory’s architecture. As we can in our install directory ‘C:\Program Files\MongoDB\Server\4.2’: we have three directories:
- Bin: to store binaries files
- Data: to data in the data directory specified by –dbpath
- Log: to store log files
MongoDB is configured using the configuration file C:\Program Files\ MongoDB\ Server\4.2\bin\mongod.cfg
This is our mongod.cfg in our Demo Install:
# mongod.conf
# for documentation of all options, see:
# http://docs.mongodb.org/manual/reference/configuration-options/
# Where and how to store data.
storage:
dbPath: C:\Program Files\MongoDB\Server\4.2\data
journal:
enabled: true
# engine:
# mmapv1:
# wiredTiger:
# where to write logging data.
systemLog:
destination: file
logAppend: true
path: C:\Program Files\MongoDB\Server\4.2\log\mongod.log
# network interfaces
net:
port: 27017
bindIp: 127.0.0.1
#processManagement:
#security:
#operationProfiling:
#replication:
#sharding:
## Enterprise-Only Options:
#auditLog:
#snmp:
- Installation MongoDB 4.2 using the msiexec.exe:
MongoDB’s Installation using the MongoDB Installer wizard gives us the chance to control the installation process and it is an interactive process based on the installation’s progresses.
Otherwise, if we choose to install MongoDB in silent and unattended, we can use msiexec.exe from the command line.
There are the steps to be followed:
- Open a Windows command prompt/interpreter (cmd.exe) in Administrator mode
- From this command prompt that’s opened, go to the directory where the MongoDB installer is downloaded and run the following command:
msiexec.exe /l*v mdbinstall.log /qb /i mongodb-win32-x86_64-2012plus-4.2.2-signed.msi ^
INSTALLLOCATION=”C:\MongoDB\Server\4.2\”
To personalize the installation directory, we add the option installation. If we want to preserve the default one, we can omit this option.
Starting with Windows 8 or greater, we can use the msiexec.exe to install all MongoDB binaries, including MongoDB Compass. So to omit its installation we have explicitly do it using the argument SHOULD_INSTALL_COMPASS=”0″ as follows:
msiexec.exe /l*v mdbinstall.log /qb /i mongodb-win32-x86_64-2012plus-4.2.2-signed.msi ^
SHOULD_INSTALL_COMPASS=”0″
Moreover, we have the option to install specific MongoDB component sets; we can specify them in the ADDLOCAL argument as follows:
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 and include Compass in the installs we can just run this:
msiexec.exe /l*v mdbinstall.log /qb /i mongodb-win32-x86_64-2012plus-4.2.2-signed.msi ^
ADDLOCAL=”ServerService,Client” ^
Hi. How can we also pass username and password ?
Thank for sharing, best tutorials