Install MongoDB on cPanel or CentOS

Install MongoDB
Install MongoDB

Install MongoDB on cPanel or CentOS

MongoDB is a free and open-source database. It will help you to integrate data in certain types of applications easier and faster. This post will help you to install MongoDB on cPanel or CentOS.

Steps: Install MongoDB

Please enable MongoDB official repo to install the latest stable version of MongoDB.

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

Add the following to it.

name=MongoDB Repo

Then, run following command to install MongoDB.

yum install mongodb-org-server mongodb-org

Create a directory /data/db

mkdir -p /data/db

start the “mongod” daemon.

/etc/init.d/mongod start

You now have MongoDB installed and running. The prompt will look like this:

# mongo
MongoDB shell version: 2.6.12
connecting to: test

Once the installation completed, enable the “mongod” daemon on chkconfig. It will make sure the “mongod” daemon automatically start after the server reboot.

chkconfig mongod on

To get summary List of Status Statistics


Install MongoDB PHP Extension

You need to install MongoDB PHP Extension after the successful installation of MongoDB. You can install it via pecl.

pecl install mongo

Then please run the following command to make sure the PHP module is loaded properly.

php -m | grep mongo

That’s it!

If you like this post and wish to receive more articles from us, please like our FB page: Grepitout

Your suggestions and feedbacks will encourage us and help to improve further, please feel free to write your comments.

For more details on our services, please drop us an E-mail at

1 Comment

Click here to post a comment