Install MongoDB on CentOS

The following details the steps to deploy MongoDB on a CentOS using .rpm packages and basic configuration following deployment.

For deploying MongoDB on alternative platforms, check for deployment steps.

First of all we will need to configure the package management system to hold the configuration information for the MongoDB repository: by creating the following file ‘/etc/yum.repos.d/mongodb.repo ‘.

If you are installing MongoDB on a 64-bit architecture (which is recommended) add the below for the MongoDB repository:

name=MongoDB Repository

If you looking to install  32-bit version (which is not recommended  for production environments) use the below:

name=MongoDB Repository

Once the MongoDB repository has been configured, install the MongoDB daemon and tools packages.

yum install mongo-10gen mongo-10gen-server

By default, the install package configures MongoDB to use /etc/mongod.conf and the control script at /etc/rc.d/init.d/mongod. The instance will configure data files at ‘/var/lib/mongo’  and its log files in ‘/var/log/mongo’  and run using the security context of the mongod user account.

In order to control the mongod process, run the following:

service mongod start
service mongod stop 
service mongod restart

You can verify that the mongod process has started successfully by checking f the log file /var/log/mongo/mongod.log.

If you require to ensure that MongoDB starts automatically following a reboot, run the following command:

chkconfig mongod on

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s