During these days the request for MongoDB installation on Linux servers is high because the developers are really like the same.MongoDB is officially a “NoSQL” database. NoSQL refers to a database with a data model other than the tabular format used in relational databases such as MySQL, PostgreSQL, and Microsoft SQL. MongoDB features include: full index support, replication, high availability, and auto-sharding. MongoDb is usually used to store large amount of data. MongoDB helps you to integrate database information into your apps easier and faster.
MongoDB officially still not supported on cPanel servers but there is a way to install MogoDB on cPanel server and there are many users using them. The install is possible because actually cPanel server is a Linux server itself. Only problem we have is we need to create the mongo databases from shell and the users and administer it so as well.
Today we are going to install MongoDB in a cPanel server powered by Centos 6
PHP-pear for full pecl support
PHP-devel package installed to compile extension manually
Now we are performing the MongoDB install via MongoDB Repo
- Login to the server via ssh as root user.
- create a file named /etc/yum.repos.d/mongodb.repo
- In my case I am using a 64bit operating system. So need to add below lines.
[mongodb] name=MongoDB Repository baseurl=http://downloads-distro.mongodb.org/repo/redhat/os/x86_64/ gpgcheck=0 enabled=1
- use below lines if you are using a 32 bit operating system.
[mongodb] name=MongoDB Repository baseurl=http://downloads-distro.mongodb.org/repo/redhat/os/i686/ gpgcheck=0 enabled=1
- Save the file in the vim editor.
- Install MongoDB using Yum
yum install mongo-10gen mongo-10gen-server
- At this point, we have installed MongoDB on our server + cPanel box.
- Configure MongoDB to start on boot and manually start the service.
chkconfig mongod on service mongod start
- Check MongoDB Service Status
service mongod status
- Summary List of Status Statistics
- Enter the MongoDB Command Line
- By default, running this command will look for a MongoDB server listening on port 27017 on the localhost interface.if you wanted to connect to a local MongoDB server listening on port 435984
mongo --port 22222
- Install MongoDB PHP Extension, so php code can interact with MongoDB
pecl install mongo /scripts/restartsrv_httpd
- Once installed we can verify the same using below command.
php -i | grep mongo -i
So now we completed the initial setup needed for MongoDB install on a cPanel server. Please post your comments below.