You are on page 1of 8

Topic: MongoDB 5.0 Enterprise server installation on Linux 8.

2 using binary
In this QuickStart, we learn how to:

Section A: Prerequisite
• Install net-snmp package
• Create mongo user
• create necessary directories required for mongoDB configuration
• copy archive on Linux server
• set bash Profile
Section B: mongoDB configuration
• create the key-file and set permissions
• create config file for mongoDB instance
• Start mongoDB instance
• Connect mongoDB database

Fig: Application connectivity with Single instance database.

Application

Drivers

primary

Fig: Below figure showing system and directory information need to install mongoDB 4.4 on Linux.

System configuration Details


Linux version CentOS Linux release 7.6.1810 (Core)
mongodb-linux-x86_64-enterprise-rhel70-
Database version 5.0.0
Host name mongo.example.com
Port Number 27017
Data Directory /u01/app/mongo/data
Config file Directory /u01/app/mongo/config
Log Directory /u01/app/mongo/data/data.log
Section A: Prerequisite

• Install net-snmp package

• Create mongodb user

• create necessary directories required for mongoDB configuration


• Insert below parameter to /etc/security/limits.conf

###############Mongo Setting #############


mongodb soft nproc 64000
mongodb hard nproc 64000
mongodb soft nofile 64000
mongodb hard nofile 64000

• copy archive on Linux server

• set bash profile

export PATH=/u01/app/mongo/product/5.0.0/bin:$PATH
export MONGO_HOME=/u01/app/mongo/product/5.0.0/bin

Note: you can connect to mongo shell using mongo -nodb command without mongoDB configuration

Section B: mongoDB configuration

• create the key-file and setting permissions on it


[mongodb@mongo product]$ openssl rand -base64 741 >
/u01/app/mongo/pkey/dev1-key

chmod 600 /u01/app/mongo/pkey/dev1-key

• create config file for dev1 mongoDB instance. In this example I have created separate
config directory to store mongoDB instance configuration file.
[mongodb@mongo config]$ pwd
/u01/app/mongo/config

# mongod.conf
# for documentation of all options, see:
# http://docs.mongodb.org/manual/reference/configuration-options/
# where to write logging data.
systemLog:
destination: file
logAppend: true
path: /u01/app/mongo/data/mongod.log
# Where and how to store data.
storage:
dbPath: /u01/app/mongo/data
journal:
enabled: true
# engine:
# mmapv1:
# wiredTiger:
# how the process runs
processManagement:
fork: true # fork and run in background
pidFilePath: /u01/app/mongo/data/mongod.pid # location of pidfile
# network interfaces
net:
port: 27017
bindIp: localhost,mongo.example.com # Listen to local interface
only, comment to listen on all interfaces.
security:
authorization: enabled
keyFile: /u01/app/mongo/pkey/dev1-key
#security:
#operationProfiling:
#replication:

• Start mongoDB instance

• Connect database using port number.

INFORMATION: If Security parameter is enabled in configuration file, then create admin user after first
login. We will discuss more about the user creation in mongoDB operation and mongoDB Security
section.

• Connect database using admin (normal user) user


Topic: Configure mongosh 1.0.4

• Download the latest mongosh version

• Create directory for mongosh binaries


[mongodb@mongo ~]$ mkdir -p /u01/app/mongo/mongosh

• Unzip binaries to mongosh directory


• set bash Profile
export PATH=/u01/app/mongo/mongosh/1.0.4/bin:$PATH
export MONGO_HOME=/u01/app/mongo/mongosh/1.0.4/bin

• connect mongoDB Using mongosh


[mongodb@mongo bin]$ mongosh "mongodb://mongo.example.com:27017" --
username admin --authenticationDatabase admin --norc

You might also like