Thursday, July 02, 2015

Install MongoDB using yum on Linux(CentOS)


                MongoDB falls into NoSQL category of database also it is a document database that provides high performance, high availability, and easy scalability.Few of its advantages are high availability and scalability.In this post we are going to see how to install the mongodb using yum on linux.

Step 1:Create a repo file that is necessary to download the mongodb.
vim /etc/yum.repos.d/mongodb.repo
Step 2:Mongodb has two types of packages for 32-bit and 64-bit systems.
For 32-bit systems type the below information in repo file and save.
[mongodb-org-3.0]
name=MongoDB 3.0 Repository
baseurl=http://downloads-distro.mongodb.org/repo/redhat/os/i686/
gpgcheck=0
enabled=1
         In the first line of the file specify you own necessary version of the mongodb to be downloaded.Here i have used version 3.0.

For 64-bit systems type the below information in repo file and save.
[mongodb-org-3.0]
name=MongoDB 3.0 Repository
baseurl=http://downloads-distro.mongodb.org/repo/redhat/os/x86_64/
gpgcheck=0
enabled=1
         In the first line of the file specify you own necessary version of the mongodb to be downloaded.Here i have used version 3.0.
Note:It’s always better to download 64 bit for production rather than 32 bit because 32-bit MongoDB processes are limited to about 2 gb of data.But the 64 bit doesn't have that limitation. For development both versions can be used.

Step 3:Mongodb has a set of packages as below:
mongodb-org-server-3.0.4           //Mongodb server
mongodb-org-shell-3.0.4            //Mongo Shell
mongodb-org-mongos-3.0.4           //Mongo Shard
mongodb-org-tools-3.0.4            //Mongo Tools

And it contains all the above package together as a single package as below:
mongodb-org-3.0.4

To install all the packages issue the below command:
sudo yum install mongodb-org
To install mongodb server alone issue the below command:
sudo yum install mongodb-org-server-3.0.4
To install mongo shell alone issue the below command:
sudo yum install mongodb-org-shell-3.0.4
To install mongo shard alone issue the below command:
sudo yum install mongodb-org-mongos-3.0.4
To install mongo tools alone issue the below command:
sudo yum install mongodb-org-tools-3.0.4

Step 3:Start the installed mongodb server using the below command:
sudo service mongod start
The server is now started and to login to the mongo shell issue the below command:
mongo
To check the current status of mongod issue the below command:
sudo service mongod status
To stop the running mongod server use the below command:
sudo service mongod stop

It’s finished.We have installed the mongodb and now you can start exploring :)




0 comments:

Post a Comment