How to Install MongoDB 4.0.11 Version On CentOS 7.6

Installation Of MongoDB 4.0.11 Version On CentOS 7.6

Default Port : 27017

Package name : mongodb-org (mongodb-org-{server,shell,tools,mongos}

Repository

[mongodb-org-4.0]

name=MongoDB Repository

baseurl=https://repo.mongodb.org/yum/redhat/$releasever/mongodb-org/4.0/x86_64/

gpgcheck=1

enabled=1

gpgkey=https://www.mongodb.org/static/pgp/server-4.0.asc

Installation process:

Navigate to the repositories location

[root@linuxhelp ~]# cd /etc/yum.repos.d/

Create a repo file for ther mongodb version

[root@linuxhelp yum.repos.d]# vim mongodb-org-4.0.repo
[mongodb-org-4.0]
name=MongoDB Repository
baseurl=https://repo.mongodb.org/yum/redhat/$releasever/mongodb-org/4.0/x86_64/
gpgcheck=1
enabled=1
gpgkey=https://www.mongodb.org/static/pgp/server-4.0.asc

Install the MongoDB Version 4.0

[root@linuxhelp yum.repos.d]# yum install mongodb-org -y
Loaded plugins: fastestmirror, langpacks
Loading mirror speeds from cached hostfile
 * base: ftp.jaist.ac.jp
 * extras: mirrors.viethosting.com
 * updates: mirror.dhakacom.com
base                                                                                                                  | 3.6 kB  00:00:00     
extras                                                                                                                | 3.4 kB  00:00:00     
mongodb-org-4.0                                                                                                       | 2.5 kB  00:00:00     
updates                                                                                                               | 3.4 kB  00:00:00     
.
.
.
.
.
.
Installed:
mongodb-org.x86_64 0:4.0.11-1.el7                                                                                                          
Dependency Installed:
  mongodb-org-mongos.x86_64 0:4.0.11-1.el7       mongodb-org-server.x86_64 0:4.0.11-1.el7       mongodb-org-shell.x86_64 0:4.0.11-1.el7      
  mongodb-org-tools.x86_64 0:4.0.11-1.el7       

Complete!

Start and Enable the service of MongoDB

[root@linuxhelp ~]# systemctl start mongod
[root@linuxhelp ~]# systemctl enable mongod

Check the status of MongoDB

[root@linuxhelp ~]# systemctl status mongod
● mongod.service - MongoDB Database Server
   Loaded: loaded (/usr/lib/systemd/system/mongod.service; enabled; vendor preset: disabled)
   Active: active (running) since Tue 2019-08-06 15:33:04 IST; 1min 34s ago

Verify the port number of MongoDB

[root@linuxhelp ~]# netstat -tulpn | grep mongod
tcp        0      0 127.0.0.1:27017         0.0.0.0:*               LISTEN      24465/mongod        

Verify the version of MongoDB

[root@linuxhelp ~]# mongod --version
db version v4.0.11
git version: 417d1a712e9f040d54beca8e4943edce218e9a8c
OpenSSL version: OpenSSL 1.0.1e-fips 11 Feb 2013
allocator: tcmalloc
modules: none
build environment:
    distmod: rhel70
    distarch: x86_64
    target_arch: x86_64

With this, Installation Of MongoDB 4.0.11 version on CentOS 7.6

Tag : Mongodb CentOS
FAQ
Q
What is the location of DATa Directory of MongoDB?
A
The Location of MongoDB data Directory is /var/lib/mongo
Q
What is the Location of MongoDB Log File ?
A
The location of MongoDB Log file is /var/log/mongodb/mongod.log
Q
What is the configuration file of MongoDB ?
A
The configuration file of MongoDB is /etc/mongod.conf
Q
Is MongoDB similar to MYSQL?
A
MongoDB is unlike MYSQL.
Q
What is Mongodb?
A
MongoDB is a cross-platform document oriented database program which supports various forms of data