Install RockMongo on CentOS 7

RockMongo is a web-based MongoDB Management tool that is similar to the MySQL Management tool: phpMyAdmin.

This tutorial will cover the process of installing and using RockMongo on CentOS 7 x64.


In order to get hands-on experiences from this tutorial, you need to:

  • A Vultr instance running CentOS 7 x64
  • A sudo user.

Step 1: Update and reboot your server

sudo yum updatesudo shutdown -r now

After the reboot, use the same sudo user to log in again.

Step 2: Install Apache

Since RockMongo is web-based, you need to have a running web server. For the purpose of this tutorial, we will be using Apache:

sudo yum install httpdsudo systemctl start httpd.servicesudo systemctl enable httpd.service

Step 3: Setup the firewall

In order to access RockMongo from your browser, you need to allow the http traffic to get through the firewall.

sudo firewall-cmd --zone=public --permanent --add-service=httpsudo firewall-cmd --reload

Then you can visit http://[YourServerIP] from your browser to verify your setup.

Step 4: Install PHP 5 and all the necessary extensions

RockMongo is a PHP 5-based software. You need to install PHP 5 and some extensions in order for RockMongo to function properly:

sudo yum install php php-devel php-pear php-pecl-mongosudo yum install gcc openssl.x86_64 openssl-devel.x86_64sudo pecl install mongodbecho '' | sudo tee -a /etc/php.ini

Step 5: Install the latest stable version of MongoDB

Here, I will use Yum to install MongoDB 3.2.1 which as of writing is the latest stable version of MongoDB.

First, create a Yum repo for MongoDB:

cd /etc/yum.repos.dsudo vi mongodb-org-3.2.repo

Populate this file with:

[mongodb-org-3.2]name=MongoDB Repositorybaseurl=$releasever/mongodb-org/3.2/x86_64/gpgcheck=0enabled=1

Save and quit:


Then install and setup MongoDB using the following commands:

sudo yum install -y mongodb-orgsudo systemctl start mongod.servicesudo systemctl enable mongod.service

Step 6: Configure the system to prevent warning messages when using MongoDB

Some configuration tweaks are required before you can start using MongoDB:

a) Disable the transparent huge pages

For this purpose, you need to create a startup script:

sudo vi /etc/init.d/disable-transparent-hugepages

Copy the following code section into it:

#!/bin/sh### BEGIN INIT INFO# Provides:          disable-transparent-hugepages# Required-Start:    $local_fs# Required-Stop:# X-Start-Before:    mongod mongodb-mms-automation-agent# Default-Start:     2 3 4 5# Default-Stop:      0 1 6# Short-Description: Disable Linux transparent huge pages# Description:       Disable Linux transparent huge pages, to improve#                    database performance.### END INIT INFOcase $1 in  start)    if [ -d /sys/kernel/mm/transparent_hugepage ]; then      thp_path=/sys/kernel/mm/transparent_hugepage    elif [ -d /sys/kernel/mm/redhat_transparent_hugepage ]; then      thp_path=/sys/kernel/mm/redhat_transparent_hugepage    else      return 0    fi    echo 'never' > $/enabled    echo 'never' > $/defrag    unset thp_path    ;;esac

Save and quit:


Make sure the script is executable and added to the system startup:

sudo chmod 755 /etc/init.d/disable-transparent-hugepagessudo chkconfig --add disable-transparent-hugepages

Additionally, you need to adjust the tuned configuration:

sudo mkdir /etc/tuned/no-thpsudo vi /etc/tuned/no-thp/tuned.conf

Copy the following content into it:


Save and quit:


Execute tuned-adm:

sudo tuned-adm profile no-thp

b) Configure ulimit values

sudo vi /etc/security/limits.conf

Append the following 4 rows to the end of this file:

mongod soft nofile 64000mongod hard nofile 64000mongod soft nproc 32000mongod hard nproc 32000

Save and quit:


Reboot the system to put your changes into effect:

sudo shutdown -r now

Step 7: Install and Use RockMongo

Download the latest stable release of RockMongo from GitHub:

cd ~wget zxvf 1.1.7.tar.gz

For security purposes, you need to modify the RockMongo administrator’s username and password:

vi rockmongo-1.1.7/config.php

Find the following row:

$MONGO["servers"][$i]["control_users"]["admin"] = "admin";//one of control users ["USERNAME"]=PASSWORD, works only if mongo_auth=false

In this row, modify the first admin string as your custom username, the second admin string as your custom password. Then save and quit:


Finally, move the whole directory to your Web directory:

sudo mv ~/rockmongo-1.1.7 /var/www/html/

Now, you can visit http://[YourServerIP]/rockmongo-1.1.7 from your browser and log in RockMongo with the credentials you setup earlier.

This concludes our tutorial. Thank you for reading.

Want to contribute?

You could earn up to $300 by adding new articles

Submit your article
Suggest an update
Request an article

No comments

Powered by Blogger.