errorCodex - Computer Questions & Solutions Forum


  errorCodex - Computer Questions & Solutions Forum » Blue Screen » Basic How-tos

Basic How-tos Help Us Noobs by Sharing Your Wisdom

Reply
 
Thread Tools
  #1  
Old 4 July 2010, 13:08
Miraenda's Avatar
Miraenda Miraenda is offline
Mime Stalker
 
Join Date: Nov 2009
Location: Coralville Iowa
Age: 37
Posts: 75
Miraenda has disabled reputation
Default How-to Install mongoDB on CentOS 5

Installing mongoDB on Centos 5

If you want to install mongoDB on CentOS, it is pretty straightforward. Here are the steps:

1. Add the mongoDB repository

In the /etc/yum.repos.d/CentOS-Base.repo file, add the following lines if your system is CentOS 5 64-bit:
Code:
[10gen]
name=10gen Repository
baseurl=http://downloads.mongodb.org/distros/centos/5.4/os/x86_64/
gpgcheck=0
Add these lines into /etc/yum.repos.d/CentOS-Base.repo file if your system is CentOS 5 32-bit:
Code:
[10gen]
name=10gen Repository
baseurl=http://downloads.mongodb.org/distros/centos/5.4/os/i386/
gpgcheck=0
2. Run yum update and install

Run the following commands:
Code:
yum update
yum install mongo-stable
yum install mongo-stable-server
3. Start mongod service

To start mongo, run the following command:
Code:
service mongod start
You should now be able to get into the mongo command line for managing databases using the mongo command in root SSH.

If you receive the following error when either trying to start mongo or trying to get into the command line interface:
Code:
# mongo
MongoDB shell version: 1.4.4
url: test
connecting to: test
Sun Jul  4 11:53:03 JS Error: Error: couldn't connect: couldn't connect to 
server 127.0.0.1 127.0.0.1:27017 (anon):952
Sun Jul  4 11:53:03 User Exception 12513:connect failed
exception: connect failed
Check that your firewall is not blocking port 27017. Mongo connects on this port for localhost, so it needs to be open for mongo to function.

mongoDB Drivers

Of note, depending on which scripting language you will be using for mongo, you would need to obtain the drivers for that language. A list of the available drives can be found at this location.

I intend to provide instructions on installing the drivers for Perl, PHP and Ruby in future posts in this thread.

Configuration File

Finally, if you want to see the configuration options for mongo, you can view the configuration file for it at /etc/mongod.conf

I would imagine any changes made to that file require mongo to be restarted with the service mongod restart command.

Monitoring and Diagnostics

There is an HTTP monitor automatically set to the server's hostname on port 28017, so you can normally point your browser to http://hostname.domain.com:28017/ and get details such as reads, writes, locks and so on.

Another tool is mongostat in root shell. You can use the --help flag to see the options for it.
__________________
Miraenda
~ Ex uno disce omnes ~
Reply With Quote
  #2  
Old 4 July 2010, 14:01
Miraenda's Avatar
Miraenda Miraenda is offline
Mime Stalker
 
Join Date: Nov 2009
Location: Coralville Iowa
Age: 37
Posts: 75
Miraenda has disabled reputation
Default Re: How-to Install MongoDB on CentOS 5

Installing PHP mongoDB Driver and phpMoAdmin GUI Interface

To use mongo with PHP, you would simply install it via PECL. Since my machine has cPanel, I did it this way in WHM > Software > Module Installers > PHP Pecl > Manage. On the new screen, I entered mongo below the "Install a PHP Pecl" area, then clicked the Install Now button.

The cPanel PECL program actually places the extension into /usr/local/lib/php.ini for you at the top:
Code:
extension="mongo.so"
You can check a phpinfo page on your account to ensure it is indeed loading.

At that point, you can then use an application called phpMoAdmin to handle managing the databases via a GUI if you prefer. The program can be installed this way:
Code:
cd /home/username/public_html/
wget http://www.phpmoadmin.com/file/phpmoadmin.zip
unzip phpmoadmin.zip
You should then be able to load http://mysite.com/moadmin.php file in a browser. To password protect the GUI interface, simply open moadmin.php file and uncomment this line:
Code:
//$accessControl = array('scott' => 'tiger');
So that it looks like this:
Code:
$accessControl = array('scott' => 'tiger');
Change the username scott and the password tiger to whatever username and password you prefer.

To change the phpMoAdmin theme (3 choices), you can edit this line:
Code:
define('THEME', 'swanky-purse');
Change swanky-purse to trontastic or classic for one of the other themes. I personally prefer the trontastic one.

Enjoy!
__________________
Miraenda
~ Ex uno disce omnes ~
Reply With Quote
Reply

Bookmarks

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -6. The time now is 15:12.


A vBSkinworks Design
Powered by vBulletin® Version 3.8.1
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.