3/27/15

How to Install MongoDB 3.0 on CentOS/RHEL & Fedora


MongoDB (named from “huMONGOus“) is a full flexible index support and rich queries database. Its is a NoSQL database. MongoDB provides large media storage with GridFS. Clickhere for more details about mongoDB.
MongoDB has released new stable version 3.0 with lots of major enhancements. This tutorial will help you to install MongoDB 3.0.X on CentOSRHEL and Fedora Systems.
Key Features of This Release:-
  • Introduces a pluggable storage engine API that allows third parties to develop storage engines
  • Introduces support for the WiredTiger storage engine.
  • Increased more consistency on updating and inserting data
  • The MMAPv1 storage engine adds support for collection-level locking
  • In MongoDB 3.0, replica sets can have up to 50 members.
  • Various enhancements for clusters.
  • Read more…

Step 1: Add MongoDB Yum Repository

Add following content in yum repository configuration file /etc/yum.repos.d/mongodb.repo as per your required MongoDB version and system architecture. For this article we are using MongoDB 3.0 repository.

For MongoDB 3.0.X

For 64bit Systems:
[MongoDB]
name=MongoDB Repository
baseurl=http://repo.mongodb.org/yum/redhat/$releasever/mongodb-org/3.0/x86_64/
gpgcheck=0
enabled=1

For MongoDB 2.6.X

For 64bit Systems:
[MongoDB]
name=MongoDB Repository
baseurl=http://downloads-distro.mongodb.org/repo/redhat/os/x86_64/
gpgcheck=0
enabled=1
For 32bit Systems:
[MongoDB]
name=MongoDB Repository
baseurl=http://downloads-distro.mongodb.org/repo/redhat/os/i686/
gpgcheck=0
enabled=1

Step 2: Install MongoDB

Lets use yum package manager to install mongodb-org package, it will automatically install all its dependencies. To install any specific revision of mongodb specify package name with version like mongodb-org-3.0.0. Following command will install latest stable version available.
# yum install mongodb-org
...
...
Dependencies Resolved

====================================================================== ======
 Package                          Arch      Version        Repository   Size
====================================================================== ======
Installing:                                                            
 mongodb-org                      x86_64    3.0.0-1.el7    MongoDB     4.5 k
Installing for dependencies:                                           
 mongodb-org-mongos               x86_64    3.0.0-1.el7    MongoDB     3.8 M
 mongodb-org-server               x86_64    3.0.0-1.el7    MongoDB     8.1 M
 mongodb-org-shell                x86_64    3.0.0-1.el7    MongoDB     4.0 M
 mongodb-org-tools                x86_64    3.0.0-1.el7    MongoDB      31 M
                                                                       
Transaction Summary                                                    
====================================================================== ======
Install  1 Package (+4 Dependent packages)

Total download size: 47 M
Installed size: 147 M
Is this ok [y/d/N]: y
...
...

Step 3: Start MongoDB

Package mongodb-org-server provided MongoDB init script, Use that script to start service.
# /etc/init.d/mongod restart
Configure MongoDB to auto start on system boot.
# chkconfig mongod on

Step 4: Check MongoDB Version and Test Setup

Use following command to check installed mongodb version
[root@tecadmin ~]#  mongo --version

MongoDB shell version: 3.0.0
Connect MongoDB using command line and execute some test commands for checking proper working.
[root@tecadmin ~]#  mongo

> use mydb;
> db.test.save( { a: 1 } )
> db.test.find()

  { "_id" : ObjectId("54fc2a4c71b56443ced99ba2"), "a" : 1 }
Congratulation’s You have successfully installed mongodb server on your system. For practice only you may use MongoDB browser shell.

0 comments:

Post a Comment

SUBSCRIBE TO NEWSLETTER

FIND US ON FACEBOOK

FIND US ON Twitter

FIND US ON GOOGLE+