How To Install MongoDB on CentOS 6.X or WHM Server

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

if pecl not installed

install it first

 yum install php-pear php5-dev

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s