Thursday, July 28, 2011

Nagios Client (NRPE) installation in Linux

i. Create Account Information
Become the root user. You may have to use sudo -s on Ubuntu and other distros.
su -l
Create a new nagios user account and give it a password.
/usr/sbin/useradd nagios
passwd nagios

ii. Install the Nagios Plugins
Create a directory for storing the downloads.
mkdir ~/downloads
cd ~/downloads

Nagios Client(NSClient) Installation in Windows

Installing nagios client is very simple. Download NSClient from location:
http://nsclient.org/nscp/downloads

You can download NSClient for 64 or 32 bit computer as required.

Copy NSClient in any folder. For e.g. D:\Nagios

Double click and install it. You will be asked for following information:
Allowed host: 'IP of your nagios server'
NSClient Password: 'Password you used when installing nagios server'
Also, enable the modules you need.

 Now configuration is finished. Restart NSClient. Fo this, go to 
Control Panel->Administrative Tools->Services->NSClient++
Start/Restart it.

Quick Installation of Nagios in CentOS

Nagios is a system and network monitoring application. Installation process is as below:

Prerequisites:
Before installing Nagios, you need to install the following on your linux machine:
     Apache
     PHP
     GCC compiler
     GD development libraries
You can use yum to install these packages by running the command:
yum install httpd php
yum install gcc glibc glibc-common
yum install gd gd-devel

Thursday, July 21, 2011

Completely Unistall MySQL

Whenever you install MySQL, uninstall it and try to install it again, you might not be able to do so because MySQL will ask for the old password. You cannot install MySQL if you do not have the old password. Solution for this is:

  • Uninstall MySQL
  • Go to your MySQL installation folder for e.g. C:\Program Files and delete the MySQL folder
  • Delete MySQL from your AppData folder. I am using windows XP and in my case, the location is C:\Documents and Settings\All Users\Application Data. Here you will find MySQL folder. Delete this folder.
  • Finally, reinstall MySQL and you should be able to install it successfully.

Sunday, July 17, 2011

Transferring cake baked code from windows to centos (linux)

First thing to do is to install cakephp in centos. Please refer to my previous blog on this(http://codebyte.blogspot.com/2011/07/installing-cakephp-in-centos.html) if you have not already installed cakphp.

Now, transfer your code to your document root (For e.g. /var/www/html in my case). Suppose, the name of your application is myapp, then
1. Open var/www/html/myapp/webroot/index.php

  • Search for if (!defined('CAKE_CORE_INCLUDE_PATH')).
  • You may find something like: define('CAKE_CORE_INCLUDE_PATH', 'C:' . DS. 'xampp' .DS. 'cake' if you used xampp in windows.
  • Change this to the location of your installed cakephp folder. For e.g. define('CAKE_CORE_INCLUDE_PATH', .DS . 'var' . DS. 'www' .DS. 'html' .DS. 'cake')

2. Open /var/www/html/myapp/config/database.php and provide appropriate database settings.

Finally, restart your apache server (/etc/init.d/httpd restart).

Installing CakePHP on CentOS

Download Cakephp
https://github.com/cakephp/cakephp/downloads

Rename it to something like cake. Extract from .tar.gz files.
tar -xvzf cake

Put 'cake' folder inside your document root. For e.g. if your document root is /var/www/html, put the cake folder inside it. Then follow some guidelines below.
1. Give appropriate permission setting for your 'cake' folder.
2. Open /cake/app/config/core.php. Go to the line where security.salt is defined and change it to some other value. Also do the same for security.cipherSeed.
3. Rename database.default.php to database.php and provide appropriate database settings

Now, open your browser and go to http://localhost/cake.

If you do no see any color in the page, you might want to check two things. Go to /etc/httpds/conf/httpd.conf and
1.  Search for mod_rewrite.so and check if LoadModule rewrite_module_modules modules/mod_rewrite.so is commented. If so, remove the comment.
2. Search for 'Options Indexed FollowSymLinks' and change 'AllowOverride None' to 'AllowOverride All' as below:
   <Directory />
    Options Indexed FollowSymLinks
    AllowOverride All
   </Directory>
 Note: Make sure you make the change in 'Options Indexed FollowSymLinks' and not in 'Options FollowSymLinks'.

Finally, restart apache (/etc/init.d/httpd restart).

Slow Connection to MySQL installed on windows from linux (Solved)

If you have MySQL installed in Windows server and you are querying from Linux, you might notice that the performance of you application is very slow. This is because, when your application in Linux connects to database in Windows, even a simple query takes 3-4 seconds to execute.

The solution for this problem is to put a line 'skip-nam-resovle' in my.ini of your mysql server. Search for [mysqld] in my.ini and put that line below it as below.

[mysqld]
skip-name-resolve