Thursday, November 20, 2014

Install RockMongo For Mongodb On CentOS and Ubuntu

Install RockMongo For Mongodb On CentOS

Install the prerequisites for mongo-php-driver and some development tools
# yum install php-devel git httpd
# yum install gcc make
Compile the driver from the latest source code on Github
# git clone https://github.com/mongodb/mongo-php-driver.git
# cd mongo-php-driver/
# phpize
# ./configure
# make all
# make install
Add the following line to your php.ini file:
# vi /etc/php.ini
After opening the php.ini file,
extension=mongo.so
Get the latest rockmongo zip file and unzip it into root directory of the Apache web server, i.e., RockMongo v1.1.5 (2012/12/20); Remember to restart the Apache.
# wget http://rockmongo.com/downloads/go?id=12
# mv rockmongo-1.1.5.zip /var/www/html/
# cd /var/www/html/
# unzip rockmongo-1.1.5.zip
# /etc/init.d/httpd restart
Visit http://ipaddress-or-hostname/rockmongo and sign-in with the default username and password (admin/admin)
RockMongo
We can change the sing-in account in config.php file:
# vi /var/www/html/rockmongo/config.php
find the following snippet and change it
$MONGO["servers"][$i]["control_users"]["admin"] = "admin";

TROUBLESHOOTING – Open Apache httpd web server port 80

# vi /etc/sysconfig/iptables 
Add the following line to your iptables:
-A INPUT -m state --state NEW -m tcp -p tcp --dport 80 -j ACCEPT

TROUBLESHOOTING – Unable to connect MongoDB

Unable to connect MongoDB, please check your configurations. MongoDB said:Failed to connect to: 127.0.0.1:27017: Permission denied.
# /usr/sbin/setsebool -P httpd_can_network_connect 1 
Then restart Apache.



Install Rockmongo on Ubuntu

For people who are searching for mongodb web admin interface, here I suggest you to use Rockmongo.
RockMongo is a MongoDB administration GUI tool, written in PHP 5.
You can read more at here.
So, first you need to install php-mongo on Ubuntu
Install PHP Pear package;

$sudo apt-get install php-pear
Then, install PHP-Mongo driver that connects PHP and MongoDB;

$sudo pecl install mongo
Then, configure PHP-Mongo driver in Apache2

$nano etc/php5/apache2/php.ini
add line below;

extension=mongo.so
Restart Apache2 server

$sudo service apache2 restart
Then, download Rockmongo from web
http://rockmongo.com/downloads
Extract to /var/www/ folder

unzip rockmongo-.zip /var/www/
Edit config.php file an fill the required info (if any)
* In my case, I didn’t change anything
Open the web interface at http://localhost/rockmongo/




Setting up the RockMongo GUI on Ubuntu


The easiest way to get started is to install Apache and PHP:
$ sudo apt-get install apache2 php5 php-pear

If you need to edit the Apache ports because you already have another server running on port 80 then edit /etc/apache2/ports.conf.

You’ll need to install the PHP Mongo connector:
sudo pecl install php_mongo
sudo pecl install mongo

Add “extension=mongo.so” to the “Dynamic Extensions” section of /etc/php5/apache2/php.ini and restart Apache with sudo service apache2 restart.


 

No comments:

Post a Comment