Wednesday, September 22, 2010

5 Step Jboss set up RHEL/Cent OS 5.X

Step:1:-  yum install mysql mysql-server java-1.6.0-openjdk -y
Step:2:- service mysqld start
Step:3:- wget  http://sourceforge.net/projects/jboss/files/JBoss/JBoss-6.0.0.M4/jboss-as-
distribution-6.0.0.20100721-M4.zip/download
Step:4:- unzip jboss-as-distribution-6.0.0.20100721-M4.zip
Step:5:- /opt/jboss/bin/run.sh

http://yourdomain.com:8080 

Monday, September 20, 2010

Install Latest postgresql using yum from pgsqlrpms


[root@ip-173-201-21-11 ~]# wget http://yum.pgsqlrpms.org/reporpms/8.4/pgdg-centos-8.4-2.noarch.rpm
[root@ip-173-201-21-11 ~]# rpm -ivh pgdg-centos-8.4-2.noarch.rpm
[root@ip-173-201-21-11 ~]# yum install postgresql postgresql-devel postgresql-server postgis pgadmin postgresql-contrib
[root@ip-173-201-21-11 ~]# chkconfig postgresql on
[root@ip-173-201-21-11 ~]# service postgresql initdb
[root@ip-173-201-21-11 ~]# chkconfig postgresql on && service postgresql start
[root@ip-173-201-21-11 ~]# psql --version
psql (PostgreSQL) 8.4.4
contains support for command-line editing

#########################################
vi /var/lib/pgsql/data/postgresql.conf
# – Connection Settings -
listen_addresses = ‘*’
port = 5432

CPULOAD and send email to admin

This script is very useful for system admins, it checks Cpuload and get info of which process takes the cpuload, if cpuload is or above 70%  it sends alert email to admin
==============================
#!/bin/bash
# Shell script to monitor or watch the high cpu-load
# It will send an email to $ADMIN, if the (cpu load is in %) percentage
# of cpu-load is >= 70%
# If you have any suggestion or question please email to raviindiangnu org
# set admin email so that you can get email
# set alert level 70% is default
# you can set it to string LOAD with your value

AWK=/bin/awk
SAR=/usr/bin/sar
GREP=/bin/grep
TR=/usr/bin/tr
HEAD=/usr/bin/head
PS=/bin/ps
SORT=/bin/sort
HOSTNAME=yeswedeal.com
SED=/bin/sed
LOAD=70
CAT=/bin/cat
MAILFILE=/tmp/mailviews$$
MAILER=/bin/mail
mailto=”rajatjpatel@yeswedeal.com”
for path in $PATHS
do
CPU_LOAD=`$SAR -P ALL 1 2 | $GREP ‘Average.*all’ | $AWK -F” ” ‘{ print 100.0 -$NF}’`
echo $CPU_LOAD
if [[ $CPU_LOAD > $LOAD ]];
then
PROC=`$PS -eo pcpu,pid -o comm= | $SORT -k1 -n -r | $HEAD -1`
echo “Please check your processess on ${HOSTNAME} the value of cpu load is $CPU_LOAD % & $PROC” > $MAILFILE
$CAT $MAILFILE | $MAILER -s “CPU Load is $CPU_LOAD % on ${HOSTNAME}” $mailto
fi
done
=============================
After  end of  schedule cron job for this script like below
*/30 * * * * /bin/sh /root/cpuload.sh >/dev/null 2>&1

How to install GeoIP and mod_geoip2 on RHEL/Cent OS for apache

How to install GeoIP and mod_geoip2 on centos for apache
1) yum install GeoIP GeoIP-devel GeoIP-data zlib-devel
2) mkdir /usr/local/share/GeoIP
3) Download the latest Country and City database files from maxmind
cd /usr/local/share/GeoIP
wget http://geolite.maxmind.com/download/geoip/database/GeoLiteCountry/GeoIP.dat.gz
wget http://geolite.maxmind.com/download/geoip/database/GeoLiteCity.dat.gz
gunzip GeoIP.dat.gz
gunzip GeoLiteCity.dat.gz
4) yum install httpd-devel apr-devel
5) wget http://geolite.maxmind.com/download/geoip/api/mod_geoip2/
6) tar xvzf mod_geoip2_1.2.5.tar.gz && cd mod_geoip2_1.2.5
7) apxs -i -a -L/usr/lib64 -I/usr/include -lGeoIP -c mod_geoip.c
8) Enabling mod-geoip
Nothing’s going to work unless mod-geoip is enabled in your apache configuration. You’ll need the following lines in your httpd.conf file (located on CentOS systems at /etc/httpd/conf/httpd.conf)
IfModule mod_geoip.c
GeoIPEnable On
GeoIPDBFile /usr/local/share/GeoIP/GeoIP.dat Standard
GeoIPDBFile /usr/local/share/GeoIP/GeoLiteCity.dat Standard
IfModule
9) Restart Apache so your changes will take effect by entering the following command.
#/etc/init.d/httpd restart
10) /usr/local/bin/geoipupdate