Installing MongoDB in Cpanel (VPS/Cloud)

This article applies for all Linux VPS & Linux Cloud clients.

Installing MongoDB is an easy and short process, but you will need to create the Mongo databases from shell (ssh/putty) and administer them from there as well (VPS or Cloud).

To do that, please follow the steps below:

1. Install the MongoDB repo:

cd /etc/yum.repos.d

2. Create the mongodb.repo file:

nano -w mongodb.repo

3. Paste this code inside:

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

4. Install MongoDB using Yum:

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

PS: At this point, you should have MongoDB installed on your CentOS + cPanel box.

5. Configure MongoDB to automatically start after reboot:

chkconfig mongod on

6. Start MongoDB:

service mongod start

7. Use the powerful PECL command to install your MongoDB PHP extension:

pecl install mongo

8. Restart Apache to apply changes:

service httpd restart

9. Verify installation with this command:

php -i | grep mongo -i

– If you see the MongoDB extension in the output, then you are all set!

Leave a Reply

Your email address will not be published. Required fields are marked *