How to install MongoDB on RHEL/Centos/Fedora Server

How to install MongoDB on RHELCentos Fedora Server

Introduction to MongoDB:-

MongoDB is an open source schema less database system which provides a document-oriented data model. The prime concern was that MySQL is written using SQL queries, while MongoDB is focused on BSON (Binary JSON). It is a cross-platform NoSQL database. It is table based relational database structure in favor of json like documents with dynamic schemas, making the integration of data in certain types of applications easier and faster. MongoDB is free and open-source software.

So let’s see the steps to install mongoDB on RHEL/Centos or Fedora Server.

How-to-install-MongoDB-on-RHELCentos-Fedora-Server

Installation procedure:-

Step: 1  System Login as root user. We are checking system OS type and system bit type.

 # uname –a
   # cat /etc/issue

Step: 2  Now we are creating a yum repo file .like /etc/yum.repos.d/mongodb.repo

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

For we are using as 64 bit System:

[mongodb]
name=mongodb Repository
baseurl=http://downloads-distro.mongodb.org/repo/redhat/os/x86_64
gpgcheck=0
enabled=1

For we are using as 32 bit System:

[mongodb]
name=mongodb Repository
baseurl=http://downloads-distro.mongodb.org/repo/redhat/os/i686
gpgcheck=0
enabled=1

Step:3  Now we install MongoDB client and server using Yum

       # yum install mongo mongo-server

Step:4  Now we can configure and basic setting in MongoDB Database Server

       # vi /etc/mongod.conf
       logpath=/var/log/mongo/mongod.log
       port=27017
       dbpath=/var/lib/mongo

Step:5  Start MongoDB Server

       # /etc/init.d/mongod start

Step:6  Start MongoDB Server on system boot time

       # chkconfig mongod on

Step:7  Test MongoDB server

# mongo
   	> use test
   	switched to db test
  	> db.test.find()
 	> db.test.save({sd: 1})
	> db.test.find()
  	{ "_id" : ObjectId("4b9ef53c4f450969bb35a1a9"), "sd" : 1 }
   > db.test.update( {sd: 1}, {sd: 5})
   > db.test.find()
 	{ "_id" : ObjectId("4b9ef53c4f450969bb35a1a9"), "sd" : 5 }

 

Conclusion:-

MongoDB has an official driver for a variety of popular programming languages and development environments.

We at Andolasoft having vast expertise on implementing MongoDB database as backend in several cutting edge applications. We have developed many apps like OrangeGigs, SQUADZ  by using MongoDB as backend.

You can also see: How to Import csv configuration file to device’s SQLite db

Hope it will be helpful for you. I’d love to hear about your thoughts on this.
Thank you for your Interest.

Leave a Reply