Alternative databases such as NoSQL or MongoDB are increasingly becoming more popular. In this guide, I want to take a look at how to install MongoDB on a CentOS WHM server and what content management systems already support it

Installing MongoDB via MongoDB Repo

MongoDB has its own Repo. There are a bunch of great Repo’s out there, such as the Atomicorp Repo (gotroot) that may include MongoDB, but in this case we are going to add the official repo and use that to install it

1. On a CentOS server enter

cd /etc/yum.repos.d

– other systems such as Ubuntu and Debian have a similar folder where repos are stored

2. Now let’s create a new file called mongodb.repo

pico mongodb.repo

3. Copy and paste this code:

name=MongoDB Repo

4. Hit CTRL + O to write the file, then CTRL + X to exit

5. Now let’s use yum to install MongoDB via

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

6. We’re done – if you ran into any dependencies, you need to google them or post a comment below.

7. Make sure you add the MongoDB service to your config, so it will be automatically started when you reboot your server:

chkconfig mongod on

8. Start the service with

service mongod start

Next Step: Installing The MongoDB PHP Extension

We’re not done yet. To properly use MongoDB we also need a PHP extension. What we installed above is only the service. Luckily, this PHP package is up to date and we CAN use pecl to quickly install this via

1. Enter

pecl install mongo

2. No errors? You’re done and you should see something like this:

Build Mongodb Via Pecl.png

3. If PECL failed to properly add the extension to the correct ini (sometimes you have multiple php.ini files!) then make sure to add the extension to all ini files

What Modules Can We Use On Drupal Or WordPress?

Unfortunately, WordPress does not yet support MongoDB nor NoSQL (last checked December 2013), however there are liteweight alternatives similar to WordPress that use MongoDB. If you don’t need any of the WordPress plugins, take a look at MongoPress

Drupal already has a module that partially adds MongoDB