RockMongo is a browser-accessible administration tool for MongoDB, functioning similarly to phpMyAdmin for MySQL. This guide walks you through how to install and operate RockMongo on a CentOS 7 x64 system.
Requirements Before You Begin
To follow along with this guide, ensure that you have the following in place:
- An up-to-date CentOS 7 x64 instance
- A user account with sudo privileges
Matching infrastructure at centron
Databases need care in production: centron can take over updates, backups and monitoring – from a single instance to a full cluster. Explore managed clusters →
Step 1: Install Apache Web Server
Because RockMongo operates via the web, a functioning web server is essential. In this tutorial, we will install and configure Apache:
sudo yum install httpd
sudo systemctl start httpd.service
sudo systemctl enable httpd.serviceStep 2: Configure the Firewall
To allow browser access to RockMongo, HTTP traffic must be permitted through the firewall. Use the commands below to adjust your firewall settings accordingly:
sudo firewall-cmd --zone=public --permanent --add-service=http
sudo firewall-cmd --reloadOnce complete, open your browser and visit http://[YourServerIP] to confirm that Apache is running properly.
Step 3: Install PHP 5 and Required Extensions
Since RockMongo relies on PHP 5, you need to install it along with a few essential extensions to ensure proper functionality:
sudo yum install php php-devel php-pear php-pecl-mongo
sudo yum install gcc openssl.x86_64 openssl-devel.x86_64
sudo pecl install mongodb
echo 'extension=mongodb.so' | sudo tee -a /etc/php.iniStep 4: Install MongoDB
To proceed, follow the official guide to set up MongoDB on your CentOS system.
Step 5: MongoDB Configuration Steps
Some fine-tuning is necessary before MongoDB is ready for use:
a) Deactivate Transparent Huge Pages
To do this, create a startup script:
sudo vi /etc/init.d/disable-transparent-hugepagesPaste the following script content into the file:
#!/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 INFO
case $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
;;
esacSave and exit the editor:
:wq!Make the script executable and configure it to launch at startup:
sudo chmod 755 /etc/init.d/disable-transparent-hugepages
sudo chkconfig --add disable-transparent-hugepagesNow modify the tuned configuration:
sudo mkdir /etc/tuned/no-thp
sudo vi /etc/tuned/no-thp/tuned.confInsert the following content into the configuration file:
[main]
include=virtual-guest
[vm]
transparent_hugepages=neverSave and exit:
:wq!Activate the new tuned profile:
sudo tuned-adm profile no-thpb) Set ulimit Parameters
Edit the system limits configuration:
sudo vi /etc/security/limits.confAdd the following four lines at the bottom of the file:
mongod soft nofile 64000
mongod hard nofile 64000
mongod soft nproc 32000
mongod hard nproc 32000Save and close the file:
:wq!Finally, reboot the server to apply all changes:
sudo shutdown -r nowStep 6: Install RockMongo
To begin installing RockMongo, download the most recent stable version directly from GitHub using the following commands:
cd ~
wget https://github.com/iwind/rockmongo/archive/1.1.7.tar.gz
tar zxvf 1.1.7.tar.gzNext, for security reasons, it is important to change the default RockMongo admin credentials. Open the configuration file using a text editor:
vi rockmongo-1.1.7/config.phpLocate the following configuration line:
$MONGO["servers"][$i]["control_users"]["admin"] = "admin";//one of control users ["USERNAME"]=PASSWORD, works only if mongo_auth=falseChange the first "admin" value to your desired username and the second "admin" to your preferred password. Save and exit the editor:
:wq!Move the extracted RockMongo directory to your web server’s document root:
sudo mv ~/rockmongo-1.1.7 /var/www/html/After completing the steps above, you can access RockMongo in your browser at:
http://[YourServerIP]/rockmongo-1.1.7
Log in using the customized credentials you defined in the configuration file.
Conclusion
By following the steps outlined above, you’ve successfully set up RockMongo on a CentOS 7 x64 server. This included configuring Apache, PHP, and MongoDB, adjusting system settings for optimal performance, and finally installing and securing the RockMongo interface. You can now manage your MongoDB databases conveniently through a browser-based interface at http://[YourServerIP]/rockmongo-1.1.7.
Testen Sie Ihr Setup auf ccloud³
Registrieren Sie sich in der ccloud³ und erhalten Sie 200 € Startguthaben für Ihr Projekt – z. B. für eine PostgreSQL-VM mit automatischen Backups.