How To Install MongoDB on cPanel server

If you need help installing MongoDB on cPanel server, contact us we as well as providing web hosting, vps, dedicated server and offshore hosting we also offer server management from highly skilled Canadian technician.

MongoDB is an open-source document database designed for easy of development and scaling. For more information please visit www.mongodb.org , You can also download the linux tar file for manual installation as per your customized needs. Today i had a chance to install MongoDB on one of our cpanel based server so just wanted to write down how its installed.

Note: This was installed on CentOS release 6.7 (Final) Cpanel based server. Installing it with the yum manager was lot easier and quicker.

Step 1.) Installing repo

cd /etc/yum.repos.d
nano -w mongodb.repo

Copy and Paste the below given code and save the file.

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

Step 2.) Installing the package MongoDB

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

Step 3.) Configure it to automatically start after reboots

chkconfig mongod on

Start MongoDB:

service mongod start

Starting mongod: [OK]

Step 4.) Installing MongoDB PHP Extension

pecl install mongo

Let the process complete and at the end you should see the following text.

….
Build complete.
Don’t forget to run ‘make test’.

running: make INSTALL_ROOT=”/root/tmp/pear/pear-build-rootv6pAQg/install-mong-1.6.13″ install
Installing shared extensions: /root/tmp/pear/pear-build-rootv6pAQg/install-mongo-1.6.13/usr/local/lib/php/extensions/no-debug-non-zts-20121212/
running: find “/root/tmp/pear/pear-build-rootv6pAQg/install-mongo-1.6.13” | xargs ls -dils
6292373 4 drwxr-xr-x 3 root root 4096 Apr 9 02:58 /root/tmp/pear/pear-build-rootv6pAQg/install-mongo-1.6.13
6292524 4 drwxr-xr-x 3 root root 4096 Apr 9 02:58 /root/tmp/pear/pear-build-rootv6pAQg/install-mongo-1.6.13/usr
6292525 4 drwxr-xr-x 3 root root 4096 Apr 9 02:58 /root/tmp/pear/pear-build-rootv6pAQg/install-mongo-1.6.13/usr/local
6292526 4 drwxr-xr-x 3 root root 4096 Apr 9 02:58 /root/tmp/pear/pear-build-rootv6pAQg/install-mongo-1.6.13/usr/local/lib
6292527 4 drwxr-xr-x 3 root root 4096 Apr 9 02:58 /root/tmp/pear/pear-build-rootv6pAQg/install-mongo-1.6.13/usr/local/lib/php
6292528 4 drwxr-xr-x 3 root root 4096 Apr 9 02:58 /root/tmp/pear/pear-build-rootv6pAQg/install-mongo-1.6.13/usr/local/lib/php/extensions
6292529 4 drwxr-xr-x 2 root root 4096 Apr 9 02:58 /root/tmp/pear/pear-build-rootv6pAQg/install-mongo-1.6.13/usr/local/lib/php/extensions/no-debug-non-zts-20121212
6292523 1836 -rwxr-xr-x 1 root root 1878374 Apr 9 02:58 /root/tmp/pear/pear-build-rootv6pAQg/install-mongo-1.6.13/usr/local/lib/php/extensions/no-debug-non-zts-20121212/mongo.so

Build process completed successfully
Installing ‘/usr/local/lib/php/extensions/no-debug-non-zts-20121212/mongo.so’
install ok: channel://pecl.php.net/mongo-1.6.13
Extension mongo enabled in php.ini

Restart Apache to apply changes:

service httpd restart

Verify installation with this command:

php -i | grep mongodb -i

If you see the MongoDB extension in the output, That’s it you are all set.