install mongodb-3.4.1 community-edition

create repo file mongo on /etc/yum.repos.d/

[root@dbserver1]# vi /etc/yum.repos.d/mongodb.repo

name=MongoDB Repository
[root@dbserver1]# yum repolist
[root@dbserver1]# yum -y install mongodb-org.x86_64

If you are using SELinux, you must configure SELinux to allow MongoDB to start on Red Hat Linux-based systems (Red Hat Enterprise Linux or CentOS Linux).

Disable SELinux by setting the SELINUX setting to disabled in /etc/selinux/config.


start service mongodb

[root@dbserver1]# systemctl start mongod

check status running or no mongod service

[root@dbserver1]# systemctl status mongod

● mongod.service - High-performance, schema-free document-oriented database
   Loaded: loaded (/usr/lib/systemd/system/mongod.service; enabled; vendor preset: disabled)
   Active: active (running) since Sel 2017-01-10 17:56:21 WIB; 2 weeks 6 days ago
  Process: 31686 ExecStartPre=/usr/bin/chmod 0755 /var/run/mongodb (code=exited, status=0/SUCCESS)
  Process: 31681 ExecStartPre=/usr/bin/chown mongod:mongod /var/run/mongodb (code=exited, status=0/SUCCESS)
  Process: 31679 ExecStartPre=/usr/bin/mkdir -p /var/run/mongodb (code=exited, status=0/SUCCESS)
 Main PID: 31701 (mongod)
   Memory: 6.1G
   CGroup: /system.slice/mongod.service
           └─31701 /usr/bin/mongod --quiet -f /etc/mongod.conf run

Jan 10 17:56:21 systemd[1]: Starting High-performance, schema-free document-oriented database...
Jan 10 17:56:21 systemd[1]: Started High-performance, schema-free document-oriented database.
Jan 10 17:56:21 mongod[31690]: about to fork child process, waiting until server is ready for connections.
Jan 10 17:56:21 mongod[31690]: forked process: 31701
Jan 10 17:56:22 mongod[31690]: child process started successfully, parent exiting