For this lab, we disabled both firewall and SELinux :

[root@mongodb ~]# egrep "^SELINUX=" /etc/sysconfig/selinux
SELINUX=disabled
[root@mongodb ~]# systemctl is-enabled firewalld
disabled

Create a repository file :

[root@mongodb ~]# cat /etc/yum.repos.d/mongodb-org-3.2.repo
[mongodb-org-3.2]
name=MongoDB Repository
baseurl=https://repo.mongodb.org/yum/redhat/$releasever/mongodb-org/3.2/x86_64/
gpgcheck=0
enabled=1

Install MongoDB :

[root@mongodb ~]# yum -y install mongodb-org
...
...
...

Installed:
  mongodb-org.x86_64 0:3.2.3-1.el7

Dependency Installed:
  mongodb-org-mongos.x86_64 0:3.2.3-1.el7       mongodb-org-server.x86_64 0:3.2.3-1.el7       mongodb-org-shell.x86_64 0:3.2.3-1.el7
  mongodb-org-tools.x86_64 0:3.2.3-1.el7

Complete!

Start MongoDB now, and keep it started across reboot :

[root@mongodb ~]# systemctl start mongod && systemctl enable mongod
mongod.service is not a native service, redirecting to /sbin/chkconfig.
Executing /sbin/chkconfig mongod on

MongoDB is now started :

[root@mongodb ~]# systemctl status mongod
 mongod.service - SYSV: Mongo is a scalable, document-oriented database.
   Loaded: loaded (/etc/rc.d/init.d/mongod)
   Active: active (running) since Sun 2016-02-28 19:28:24 CET; 1min 38s ago
     Docs: man:systemd-sysv-generator(8)
 Main PID: 17577 (mongod)
   CGroup: /system.slice/mongod.service
           └─17577 /usr/bin/mongod -f /etc/mongod.conf

Feb 28 19:28:23 mongodb systemd[1]: Starting SYSV: Mongo is a scalable, document-oriented database....
Feb 28 19:28:23 mongodb runuser[17573]: pam_unix(runuser:session): session opened for user mongod by (uid=0)
Feb 28 19:28:24 mongodb mongod[17566]: Starting mongod: [  OK  ]
Feb 28 19:28:24 mongodb systemd[1]: Started SYSV: Mongo is a scalable, document-oriented database..

And listening :

[root@mongodb ~]# netstat -nutlp | head -2 ; netstat -nutlp | grep mongod
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address           Foreign Address         State       PID/Program name
tcp        0      0 127.0.0.1:27017         0.0.0.0:*               LISTEN      3060/mongod

 

en.pdf24.org    Send article as PDF   

Leave a Reply

Your email address will not be published. Required fields are marked *


*