HowTo Install MongoDB on RHEL 7/Centos 7

MongoDB is an open-source document database that provides high performance, high availability, and automatic scaling. NoSQL databases offer a variety of advantages in many cases. MongoDB does not support 32bit installation. MongoDB is an document-based database which developer does not required to create schema every time.Unlike relational databases, MongoDB does not require a predefined schema before you add data to a database. You can alter the schema at any time and as often as is necessary without having to setup a new database with an updated schema. Let’s see Howto Install MongoDB on RHEL 7/Centos 7 Operating system.

MongoDB Advantages

  • Horizontal scalability
  • NoSQL Databases
  • High Performance (It can deliver data 4 micro second speed)
  • Real time aggregation
  • Open Source Software

MongoDB Hardware Requirements

  • Use disks backed by RAID-10.
  • Linux kernel version 2.6.36 or later
  • XFS or Ext4 file system is required
  • Minimum 8GB RAM

MongoDB’s core components run on little-endian hardware, primarily x86/x86_64 processors. Client libraries can run on big or little endian systems.

HowTo Install MongoDB on RHEL 7

Installation of MongoDB required to setup new repository, for Linux no need of downloading packages manually.

edit repo configuration file /etc/yum.repos.d/mongodb.repo and repo configuration as shown below

vi /etc/yum.repos.d/mongodb.repo

[mongodb-repo]
name=MongoDB Repository
baseurl=https://repo.mongodb.org/yum/redhat/$releasever/mongodb-org/3.4/x86_64/
gpgcheck=1
enabled=1
gpgkey=https://www.mongodb.org/static/pgp/server-3.4.asc

:wq

To install MongoDB Server and its dependency packages

# yum install mongodb-org

mongodb installation in RHEL 7

MongoDB tools, shell, server and mongos packages will be installed

[root@arkit-mongodb-serv ~]# systemctl enable mongod.service
[root@arkit-mongodb-serv ~]# systemctl start mongod.service
[root@arkit-mongodb-serv ~]# systemctl status mongod.service
mongod.service - High-performance, schema-free document-oriented database
 Loaded: loaded (/usr/lib/systemd/system/mongod.service; enabled)
 Active: active (running) since Sat 2017-11-11 11:59:34 IST; 27min ago

Enable SELINUX and Firewall Ports For Remote Client Access

Below are default mongoDB required ports for remote operations

  • 27017 – Port for MongoDB connection
  • 27018 – ClusterRole communication shardsvr
  • 27019 – Configsvr for Clusterrole
  • 28017 – Web status page

Allow from SELinux or Disable SELinux

# semanage port -a -t mongod_port_t -p tcp 27017 
Repeat for below ports as well 27018 27019 28017

To Disable SELinux edit config file vi /etc/selinux/config

from

SELINUX=enforcing

to

SELINUX=disabled

Note: Either you can disable or allow ports. Disabling SELinux is not recommended

firewall-cmd --permanent --add-port=27017/tcp --zone=public
success
Repeat for below ports as well 27018 27019 28017

firewall-cmd --reload
success

Change your default zone name to appropriate (in this case it is public)

Restart mongod service so that changes of port will be in effect

# systemctl restart mongod

That’s it about HowTo Install MongoDB on RHEL 7 / Centos 7.

Conclusion

Started High-performance, schema-free document-oriented database is in place.

Related Articles

PXE Boot Server Installation Step by Step Guide

NFS Server Configuration Step by Step Guide

HowTo Install Red Hat Enterprise Linux 7 OS

For More Documentation Visit Official Site

Thanks for your wonderful Support and Encouragement