Posts

Showing posts from August, 2013

How to install Apache, Java, Tomcat and Solr

Here is the procedure to install Apache, Tomcat, Java and Solr:

First of all we need Apache in our box:
Download the Apache source.

tar -zxvf httpd-2.2.24.tar.gz cd httpd-2.2.24 ./configure --enable-so --enable-expires --enable-file-cache --enable-cache --enable-disk-cache --enable-mem-cache --enable-headers --enable-ssl --enable-http --disable-userdir --enable-rewrite --enable-deflate --enable-proxy --enable-proxy-connect --enable-proxy-ftp --enable-proxy-http --enable-proxy-ajp --enable-proxy-balancer --enable-cgi --disable-dbd --enable-modules=most --with-mpm=worker --prefix=/usr/local/apache2 make; make install /usr/local/apache2/bin/apachectl -t
./configure : Specify the modules which you want to install for your Apache ( ./configure with out specified modules will install all the modules )
--prefix= :  Its used to specify the path where you need to install Apache.
apachectl -t : To check the syntax of Apache

Download Java from oracle site as Tomcat and Solr will be needing Jav…

How to delete multiple user in linux

Image
To delete multiple user in Linux, refer the following video.



If you want to delete multiple system users in Linux following command can be used..
for user in `cat del.user`;do userdel $user;done
user : its the variable used to have values from del.user.
del.user : Its the file having name of the users which you want to delete.
userdel : Command used to delete user.
userdel -r : If you want to delete users home directory as well use this.

File having user names which need to be removed:
# cat del.user ravi roma ben honey chin

How to check logs hour wise and know the maximum requests in respecitive hours..

If you want to check logs per hours from a days log file use the following command:

Here time.list is the file having time period of which logs is needed by hours..

for time in `cat time.list`;do cat access.log | grep -ir 30/Jul/2013:$time: > logs_$time:00-$time:59.txt;done
It will create the separate text files having logs entry with in the time periods ex "logs_12:00-12:59.txt".


If you need to know maximum requests within specific hours use the following command:

for time in `cat time.list`;do cat access.log | grep -ir 30/Jul/2013:$time: | awk ' { print $7 } ' | sort | uniq -cd | sort -nr |head -15 > maxhit_$time:00-$time:59.txt;done
awk ' { print $7 } ' : It will take the 7th entry from logs.
sort : It will sort the hits.
uniq -cd : It will count the unique entry and not display the ones having only single entry.
sort -nr : It will count all the unique entries.
head -15 : It will display the top 15 results.

Command will create the separate t…

script to backup log files..

If there are multiple logs files which needed to be compressed and than Null following script can be used:

# vi log_compress.sh

echo $1_`date +%d%B%y` cat $1 | gzip > $1_`date +%d%B%y`.gz cp /dev/null $1
# chmod 755 log_compress.sh

For example you want to compress error.log use the following command:

# sh log_compress.sh error.log

It will compress the error log in .gz format and null the original error.log



How to install or update newrelic to latest version

Image
Use the following steps to update Relic to latest version:

Url to track latest update:
http://download.newrelic.com/php_agent/release/

Steps:
wget http://download.newrelic.com/php_agent/release/newrelic-php5-3.7.5.7-linux.tar.gztar –xvf newrelic-php5-3.7.5.7-linux.tar.gz cp –r newrelic-php5-3.7.5.7-linux /usr/local/ cd /usr/local/newrelic-php5-3.7.5.7-linux/ ls agent daemon LICENSE MD5SUMS newrelic-install README scripts
./newrelic-install /usr/local/apache2/bin/apachectl stop /usr/local/apache2/bin/apachectl start php -i | grep Relic New Relic RPM Monitoring => enabled
New Relic Version => 3.7.5.7 ("hadrosaurus")