Install mongo DB on RHEL /CentOS Fedora and Ubuntu

[box]

Mongo DB is NoSQL database, means way of storing data not like relational database.It is open source based software that is under category under document based.

MongoDB is different from other Relational database, relation database have typical design in schema that show tables and relation between tables but MongoDB not worked in relationship concept.

[/box]

Benefits of Mongo Database

[box]

Supports dynamic queries using a document based query.

Mongo Db is schema less document database, schema of one document can be different from other , which connect data through different documents. Every document can differ from other document.

Joining is not complexes.

Mono DB uses internal memory for storing the working set.

Mongo Db store the data in the form of binary JSON ( BSON) format style documents.

Auto-sharding and Rich Queries supporting.

Mongo DB is supported by Professional.

We can use MongoDb on Big Data, Mobile and social infrastructure and content management system.

Mongo Db support Nested data structure and array formats

Failover mechanism is supported by MongoDb.

[/box]

For CentOs , Red Hat and Fedora

[box]

Create a yum repository on installation server through below command and put or insert text according to your system architecture.

vim /etc/yum.repos.d/mongodb.repo

(A ) For 64 bit architecture system :

Insert below content on mongodb.repo file.

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

(B ) For 32 bit architecture system :

Insert below content on mongodb.repo file for 32 bit system architecture.

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

Then save and exit from vim editor through :wq .

[/box]

Installing MongoDB or Use mongo as a service

[box]

First Update server packages through below command :

yum -y update

and then install mongodb .

yum -y install mongodb-org mongodb-org-server

Start Mongo DB Services :

For Red Hat , CentOs 5/6 Version :

Below command is for run mongodb service on centos/rhel on version 5,6 and other command is for auto start service after reboot or on startup time.

#service mongod restart

# chkconfig mongod on

For Red Hat , CentOs 7 Version :

Below command is for run mongodb service on centos/rhel on version 7 and other command is for auto start service after reboot or on startup time.

systemctl start mongod

systemctl enable mongod

You can check mongoDB server status .

systemctl status mongod [/box]

For Ubuntu 14.x and 12.x and Debian

[box]

Now we are going to install MongoDB installation for ubuntu verson and Debian based system.

First we need to add repository and public key in our server OS.

To add public key use below command.

$ sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv EA312927

To Add repository on Ubuntu use below command.

echo "deb http://repo.mongodb.org/apt/ubuntu "$(lsb_release -sc)"/mongodb-org/3.2 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb.list

To Add repository on Ubuntu use below command.

echo "deb http://repo.mongodb.org/apt/debian "$(lsb_release -sc)"/mongodb-org/3.2 main" | sudo tee /etc/apt/sources.list.d/mongodb.list

Installing MongoDB

Use below command to install mongoDb as well as it’s dependency packages for mongoDB.

# apt-get update

#apt-get install mongodb-org

Now at the end of installation , we need to start process or service of mongodb server through below command.

# service mongod start

Check MongoDB Version

# mongod --version [/box]

That’s it. Thanks