MongoDB 3.x Installation and Initial Configuration
MongoDB 3.x Installation and Initial Configuration
What is MongoDB?
MongoDB is a cross-platform document-oriented database program. Classified as a NoSQL database program, MongoDB uses JSON-like documents with schema. MongoDB is developed by MongoDB Inc. and licensed under the Server Side Public License. For more info on MongoDB Please click here.
1. Check the Release
[root@mongotest ~]# cat /etc/redhat-release
Red Hat Enterprise Linux Server release 6.7 (Santiago)
Red Hat Enterprise Linux Server release 6.7 (Santiago)
2. Check the platrom, Here in my case it is 64 bit.
[root@mongotest ~]# uname -ix86_64
3. Create Repo for mongoDB 3.x.
[root@mongotest ~]# vi /etc/yum.repos.d/mongodb-org-3.0.repo
[mongodb-org-3.0]
name=MongoDB Repositorybaseurl=https://repo.mongodb.org/yum/redhat/$releasever/mongodb-org/3.0/x86_64/gpgcheck=0enabled=1
[root@mongotest ~]#
[mongodb-org-3.0]
name=MongoDB Repositorybaseurl=https://repo.mongodb.org/yum/redhat/$releasever/mongodb-org/3.0/x86_64/gpgcheck=0enabled=1
[root@mongotest ~]#
4. Install mongoDB.
[root@mongotest ~]# yum install -y mongodb-org
Total download size: 54 M
Installed size: 169 M
Downloading Packages:(1/5):
mongodb-org-3.0.12-1.el6.x86_64.rpm | 5.8 kB 00:00(2/5): mongodb-org-mongos-3.0.12-1.el6.x86_64.rpm | 4.7 MB 00:02(3/5): mongodb-org-server-3.0.12-1.el6.x86_64.rpm | 9.8 MB 00:02(4/5):
mongodb-org-shell-3.0.12-1.el6.x86_64.rpm | 5.0 MB 00:03(5/5):
mongodb-org-tools-3.0.12-1.el6.x86_64.rpm | 34 MB 00:08......Installed: mongodb-org.x86_64 0:3.0.12-1.el6
Dependency Installed: mongodb-org-mongos.x86_64 0:3.0.12-1.el6 mongodb-org-server.x86_64 0:3.0.12-1 mongodb-org-tools.x86_64 0:3.0.12-1.el6
Total download size: 54 M
Installed size: 169 M
Downloading Packages:(1/5):
mongodb-org-3.0.12-1.el6.x86_64.rpm | 5.8 kB 00:00(2/5): mongodb-org-mongos-3.0.12-1.el6.x86_64.rpm | 4.7 MB 00:02(3/5): mongodb-org-server-3.0.12-1.el6.x86_64.rpm | 9.8 MB 00:02(4/5):
mongodb-org-shell-3.0.12-1.el6.x86_64.rpm | 5.0 MB 00:03(5/5):
mongodb-org-tools-3.0.12-1.el6.x86_64.rpm | 34 MB 00:08......Installed: mongodb-org.x86_64 0:3.0.12-1.el6
Dependency Installed: mongodb-org-mongos.x86_64 0:3.0.12-1.el6 mongodb-org-server.x86_64 0:3.0.12-1 mongodb-org-tools.x86_64 0:3.0.12-1.el6
5. Check SELinux status. If not disabled, disable it or accept the communication at port 27017. In my case i've disabled SELinux.
semanage port -a -t mongod_port_t -p tcp 27017
[root@mongotest ~]# sestatus
SELinux status: disabled
[root@mongotest ~]#
[root@mongotest ~]# sestatus
SELinux status: disabled
[root@mongotest ~]#
6. Before starting mongoDB, change the DB server IP. Otherwise it'll bind to loopback address.
[root@mongotest ~]# vi /etc/mongod.conf
[root@mongotest ~]# grep -i bind /etc/mongod.conf
# bindIp: 127.0.0.1
# Listen to local interface only, comment to listen on all interfaces.
bindIp: 192.168.0.4
[root@mongotest ~]# grep -i bind /etc/mongod.conf
# bindIp: 127.0.0.1
# Listen to local interface only, comment to listen on all interfaces.
bindIp: 192.168.0.4
7. Strat the Service.
service mongod start
8. Make it Persistent.
chkconfig mongod on
9. Check the Logs
2016-07-29T02:52:40.481+0200 I NETWORK [initandlisten] waiting for connections on port 27017
Useful MongoDB Articles:
- How To Install MongoDB 4 on RHEL 8 / CentOS 8
- How To Install MongoDB 4 on RHEL 7 / CentOS 7
- How to Create MongoDB database and Collections
- MongoDB: Install Mongo Client and Mongo Shell in Ubuntu, CentOS
- How to delete or drop MongoDB database
- MongoDB Startup Error
- MongoDB 3.x Installation and Initial Configuration
No comments