Tuesday, December 4, 2012

How to limit the connection per ip in the server?

We can limit the number of connections per IP on server by installing mod_limitipconn for apache.This will helpfull to control the load in server also.

# cd /usr/local/src

Now, we need to grab the file (this is the latest version as of this post):

# wget http://dominia.org/djao/limit/mod_limitipconn-0.23.tar.bz2

# tar xjvf mod_limitipconn-0.23.tar.bz2

# cd mod_limitipconn-0.23

# apxs -i -a -c mod_limitipconn.c

# cd /etc/httpd/conf

Saturday, December 1, 2012

How to increase the swap filesize in server?

Sometimes, we need to increase the swap file for better performance and procedure as below.

First, Create an 1024MB filesize:

# dd if=/dev/zero of=/swapfile bs=1024 count=1048576

    1. if=/dev/zero : Read from /dev/zero file. /dev/zero is a special file in that provides as many null characters to build storage file called /swapfile.
    2. of=/swapfile : Read from /dev/zero write stoage file to /swapfile.
    3. bs=1024 : Read and write 1024 BYTES bytes at a time.
    4. count=1048576 : Copy only 1048576 BLOCKS input blocks. [ 1024 * 1024MB = 1048576 ]

Make the file as swap filesystem:

# mkswap /swapfile

Set the permission for /swapfile:

# chown root:root /swapfile
# chmod 0600 /swapfile

How to increase the temp partition in linux?

First kill the process which using the tmp directory and backup the tmp directroy.

# cp -prf /tmp /tmp.bak

Unmount the temp:

#umount /tmp

Create an 2GB filesize:


# dd if=/dev/zero of=/usr/tmpDSK bs=1024k count=2048
2048+0 records in
2048+0 records out
2147483648 bytes (2.1 GB) copied, 73.6908 seconds, 29.1 MB/s

# du -sch /usr/tmpDSK
2.1G /usr/tmpDSK
2.1G total

How to install the Multimedia package ( FFmpeg, flvtool2, facc....) in linux server ?

First, we have check whether the GNU C and C++ compilers and other development utilities installed or not. If not then install the utilites of it then only we can proceed to install the multimedia package.

RedHat/Centos: 

# yum groupinstall -y "Development Tools"

Debian/Ubuntu:

#apt-get install build-essential

Dynamic Linked Libraries Path:

Linux uses a system of shared libraries, similar to Windows dlls, for the efficient use of space and resources, and modularity. Add those below entry in  /etc/ld.so.conf

/usr/local/lib
/usr/lib

# ldconfig

Monday, November 12, 2012

Types of Linux FileSystem

Filesystem is an set of files and directories resides in an partition. Linux supports different type of filesystem and details as follow:

   minix     is the filesystem used in the Minix  operating  system,  the
                 first to run under Linux.  It has a number of shortcomings: a
                 64MB  partition  size  limit,  short  filenames,   a   single
                 timestamp,  etc.   It  remains  useful  for  floppies and RAM
                 disks.

     ext       is an elaborate extension of the minix filesystem.   It  has
                 been  completely  superseded  by  the  second  version of the
                 extended filesystem (ext2) and has  been  removed  from  the
                 kernel (in 2.1.21).

    ext2      is  the  high  performance disk filesystem used by Linux for
                 fixed disks as well as removable media.  The second  extended
                 filesystem was designed as an extension of the extended file
                 system (ext).  ext2 offers the best performance (in terms  of
                 speed  and  CPU  usage)  of  the filesystems supported under
                 Linux.

Tuesday, September 18, 2012

How to Amanda Backup Restore?


Amanda backup has can been done by recovery program amrecover, specifying your backup config, host, date, and disk entry. You can then select files with an FTP-like interface.

# amrecover BackupSet1
AMRECOVER Version 2.6.0p2. Contacting server on localhost ...
220 bass AMANDA index server (2.6.0p2) ready.
Setting restore date to today (2008-11-04)
200 Working date set to 2008-11-04.
200 Config set to BackupSet1.
200 Dump host set to bass.foo.com.
Use the setdisk command to choose dump disk to recover
amrecover> sethost bass.foo.com
200 Dump host set to bass.foo.com.
amrecover> setdate 2008-10-14
200 Working date set to 2008-10-14.
amrecover> setdisk /mnt/home8/foobar
200 Disk set to /mnt/home8/foobar.
amrecover> ls

Sunday, September 2, 2012

How to setup a Remote Client to Amanda Backup


Install the amanda client RPM as below and include lot of configuration procedure as below.

# wget http://www.zmanda.com/downloads/community/Amanda/3.3.0/Redhat_Enterprise_5.0/amanda-backup_client-3.3.0-1.rhel5.x86_64.rpm

# rpm -ivh amanda-backup_client-3.3.0-1.rhel5.x86_64.rpm
Preparing...                ########################################### [100%]
Dec  2 2008 14:56:09: Preparing to install: Amanda Community Edition - version 2.5.2p1
Dec  2 2008 14:56:09: Checking for 'amandabackup' user...
Dec  2 2008 14:56:09:
Dec  2 2008 14:56:09:  The 'amandabackup; user account has been successfully created.
Dec  2 2008 14:56:09:  Furthermore, the account has been automatically locked for you
Dec  2 2008 14:56:09:  for security purposes.  Once a password for the  'amandabackup'
Dec  2 2008 14:56:09:  account has been set, the user can be unlocked by issuing
Dec  2 2008 14:56:09:  the following command as root.:
Dec  2 2008 14:56:09:
Dec  2 2008 14:56:09:  # passwd -u amandabackup
Dec  2 2008 14:56:09:

Sunday, August 26, 2012

How to Control the Iptables ip_conntrack: table full, dropping packet ?

    If Linux server handle lots of connections, then you get the problem with ip_conntrack iptables module. Connection tracking by default handles up to a certain number of simultaneous connections. This number is dependent on you system's maximum memory size.

To View Current Limit :   

# sysctl net.ipv4.netfilter.ip_conntrack_max
   8192
or
# cat /proc/sys/net/ipv4/ip_conntrack_max
   8192

To increase the Limit:

  Generally, the ip_conntrack_max is set to the total MB of RAM installed multiplied by 16. If you have  2GB of RAM, then ip_conntrack_max was set to 32768
# sysctl -w net.ipv4.netfilter.ip_conntrack_max=32768

Or we can add in /etc/sysctl.conf

net.ipv4.netfilter.ip_conntrack_max=32768

To View Current Open Session:

# wc -l /proc/net/ip_conntrack

  2520 /proc/net/ip_conntrack

Thursday, August 16, 2012

How to fix the NO_PUBKEY / GPG error ?

When updating the Debian based system, apt-get may display an error message like:

W: GPG error: ftp://ftp.debian.org/ testing Release:     
The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 127908312D230C5F

W: There is no public key available for the following key IDs:  127908312D230C5F    

To solve this problem, get the key using gpg command and add it to the local apt repository using apt-key add command as shown below:

#gpg --keyserver pgpkeys.mit.edu --recv-key  127908312D230C5F         
#gpg -a --export 127908312D230C5F | sudo apt-key add -
#apt-get update

Sunday, August 12, 2012

What is SYN Flood?

The SYN flood attack sends TCP connections requests faster than a machine can process them.
  • attacker creates a random source address for each packet
  • SYN flag set in each packet is a request to open a new connection to the server from the spoofed IP address
  • victim responds to spoofed IP address, then waits for confirmation that never arrives (waits about 3 minutes)
  • victim's connection table fills up waiting for replies
  • after table fills up, all new connections are ignored
  • legitimate users are ignored as well, and cannot access the server
  • once attacker stops flooding server, it usually goes back to normal state (SYN floods rarely crash servers)
  • newer operating systems manage resources better, making it more difficult to overflow tables, but still are vulnerable
  • SYN flood can be used as part of other attacks, such as disabling one side of a connection in TCP hijacking, or by preventing authentication or logging between servers.

Thursday, August 9, 2012

What is MariaDB? Quick Comparison with MYSQL.


    Monty Widenius, creator of mysql left after acquiring it by Oracle and SUN in 2009. And he started the new project, MariaDB to be a replacement for mysql server.

   MariaDB and Mysql are very near to each other as brother and sister. in other words, if you have mysql 5.1, you can switch to use MariaDb 5.1 and preserve all of your stuff and configuration. On top of that all MySQL connectors , api, etc. are the same (your PHP script that works on mysql will work normally on MariaDB)

Advantages of MariaDB over Mysql:
  • More storage engines like Aria
  • It uses the XtraDB (InnoDB improved) storage engine from Percona as default.
  • Improvements on speed, specially that the optimizer had been greatly improved to handle big data with Subqueries, derived tables and views, Index Merge, and Join queries.
  • Replication is a magnitude faster in MariaDB if you have lots of concurrent updates to InnoDB

Installation of PDF support in PHP of Linux

    PDF functions in PHP can create PDF files using the PDFlib library which was initially created by Thomas Merz and is now maintained by  PDFlib GmbH. Here is the below procedure to enable the PDFlib-lite and PDFlib in the linux

#cd /usr/src/
#wget http://www.pdflib.com/binaries/PDFlib/705/PDFlib-Lite-7.0.5p3.tar.gz
#tar xvf PDFlib-Lite-7.0.5p3.tar.gz
#cd PDFlib-Lite-7.0.5p3
#./configure --prefix=/usr/local/pdflib --without-java
#make && make install

After installing the PDFLite, we have to built PDFlib DSO as below.
#cd /usr/src/
#wget http://pecl.php.net/get/pdflib-2.1.9.tgz
#tar xvf pdflib-2.1.9.tgz
#cd pdflib-2.1.9

Monday, August 6, 2012

List of Apache Error Code


Successful Client Requests:

200 OK
201 Created
202 Accepted
203 Non-Authorative Information
204 No Content
205 Reset Content
206 Partial Content

Client Request Redirected:

300 Multiple Choices
301 Moved Permanently
302 Moved Temporarily
303 See Other
304 Not Modified
305 Use Proxy

Sunday, July 29, 2012

How to Automatic root login in Debian 6.0 without GUI (xserver)?

You can enable the autologin by modifying the inittab file.

#vim /etc/inittab

Serach for the line.

1:2345:respawn:/sbin/getty 38400 tty1

Replace with as follow

1:1235:respawn:/bin/login -f root tty1 </dev/tty1 >/dev/tty1 2>&1

After modifying the inittab restart the system.

Note: before modifying the inittab, keep the backup of it.

Errors were encountered while processing: crossplatformui:i386 E: Sub-process /usr/bin/dpkg returned an error code (1)

We can  sort out issue  "Errors were encountered while processing:  crossplatformui:i386 E: Sub-process /usr/bin/dpkg returned an error code (1)" by by passing dpkg.

First, we have to move into dpkg dir and backup status file.

#cd /var/lib/dpkg/

#status status.orig

After that open it to edit:

# vim status

Search for a block something like that:

    Package: crossplatformui

    ..

    ..

    Package: another_package_name

Here, you have to delete only crossplatformui block. This means starting with Package: crossplatformui and till the other package block. After deleting the block try to remove it again:

#sudo dpkg -r crossplatformui

Tuesday, July 24, 2012

Troubleshooting Raid Issue


1. My problem from the other day was rebuilding a raid when I got ecc errors on a different disk than the one being rebuilt. I did a rescan and the ecc errors went away, but the rebuild seemed to be stuck. I contacted 3ware, makers of our raid card and was told to do this:

//cdfs3> info c0

Unit  UnitType  Status         %Cmpl  Stripe  Size(GB)  Cache  AVerify  IgnECC
------------------------------------------------------------------------------
u0    RAID-5    OK             -      64K     1396.95   ON     OFF      OFF
u1    RAID-5    REBUILDING     89     64K     1396.95   OFF    OFF      OFF      

Port   Status           Unit   Size        Blocks        Serial
---------------------------------------------------------------
p0     OK               u0     465.76 GB   976773168     WD-WCANU1137212
p1     OK               u0     465.76 GB   976773168     WD-WCANU1090078
p2     OK               u0     465.76 GB   976773168     WD-WCANU1119743
p3     OK               u0     465.76 GB   976773168     WD-WCANU1089924
p4     OK               u1     465.76 GB   976773168     WD-WCANU1136981
p5     OK               u1     465.76 GB   976773168     WD-WCANU1109927
p6     DEGRADED         u1     465.76 GB   976773168     WD-WCAPW5103756
p7     OK               u1     465.76 GB   976773168     WD-WCANU1125288     

//cdfs3> maint remove c0 p6
Exporting port /c0/p6 ... Done.

Thursday, June 14, 2012

How to Repair raid with Spare Drive?

Raid Repair with Spare Drive:

I had set up one of our raids with a spare drive. A disk in this raid failed last night and the spare was used immediately. Unfortunately, I forgot that this raid had a spare, so I spent a bit of time trying to figure out why the new disk would not rebuild. But eventually, things worked again. Here’s my log:

[root@cps1 ~]# cd tw_cli
[root@cps1 tw_cli]# ./tw_cli
//cps1> info c0

Unit  UnitType  Status         %RCmpl  %V/I/M  Stripe  Size(GB)  Cache  AVrfy
------------------------------------------------------------------------------
u0    RAID-5    OK             -       -       64K     1862.61   ON     OFF    

Port   Status           Unit   Size        Blocks        Serial
---------------------------------------------------------------
p0     OK               u0     465.76 GB   976773168     WD-WCANU2126397
p1     OK               u0     465.76 GB   976773168     WD-WCANU2051520
p2     OK               u0     465.76 GB   976773168     WD-WCANU2030999
p3     DEVICE-ERROR     u?     465.76 GB   976773168     WD-WCANU2021246
p4     OK               u0     465.76 GB   976773168     WD-WCANU2114264
p5     OK               u0     465.76 GB   976773168     WD-WCANU2051215
p6     NOT-PRESENT      -      -           -             -
p7     NOT-PRESENT      -      -           -             -
The first thing I should have noticed is that the raid was ok. Normally, if there’s a bad drive it shows up as degraded. But, I completely missed that fact and tried to rebuild it.
//cps1> maint remove c0 p3
Removing port /c0/p3 ... Done.

Tuesday, April 17, 2012

How to replace an Raid Disk?

Replacement of Raid Disk:

[root@cdfs tw_cli]# ./tw_cli

//cdfs> info c0

Unit  UnitType  Status         %Cmpl  Stripe  Size(GB)  Cache  AVerify  IgnECC
------------------------------------------------------------------------------
u0    RAID-5    OK             -      64K     1396.95   ON     OFF      OFF
u1    RAID-5    OK             -      64K     1396.95   ON     OFF      ON       

Port   Status           Unit   Size        Blocks        Serial
---------------------------------------------------------------
p0     OK               u0     465.76 GB   976773168     WD-WMASY6064174
p1     OK               u0     465.76 GB   976773168     WD-WCANU1090078
p2     OK               u0     465.76 GB   976773168     WD-WCANU1119743
p3     OK               u0     465.76 GB   976773168     WD-WCANU1089924
p4     OK               u1     465.76 GB   976773168     WD-WMASY8103731
p5     SMART-FAILURE    u1     465.76 GB   976773168     WD-WCANU1109927
p6     OK               u1     465.76 GB   976773168     WD-WCAPW5103756
p7     OK               u1     465.76 GB   976773168     WD-WCANU1125288     

//cdfs> maint remove c0 p5
Exporting port /c0/p5 ... Done.

Saturday, April 14, 2012

How to Add Raid Spare in 3ware?


Add Raid Spare:

[~]# ./tw_cli
//cp> info c8

Unit  UnitType  Status         %RCmpl  %V/I/M  Stripe  Size(GB)  Cache  AVrfy
------------------------------------------------------------------------------
u0    RAID-5    OK             -       -       64K     1862.61   ON     OFF    

Port   Status           Unit   Size        Blocks        Serial
---------------------------------------------------------------
p0     OK               u0     465.76 GB   976773168     WD-WCANU2126397
p1     OK               u0     465.76 GB   976773168     WD-WCANU2051520
p2     OK               u0     465.76 GB   976773168     WD-WCAS84972002
p3     OK               u0     465.76 GB   976773168     WD-WCAS84739115
p4     OK               u0     465.76 GB   976773168     WD-WCANU2114264
p5     OK               u?     465.76 GB   976773168     WD-WCANU2051215
p6     NOT-PRESENT      -      -           -             -
p7     NOT-PRESENT      -      -           -             -

//cp> rescan
Rescanning controller /c8 for units and drives ...Done.
Found the following unit(s): [/c8/u1].
Found the following drive(s): [none].

Wednesday, March 14, 2012

Raid Weirdness


After rebooting a node with a spare drive in the raid, I got errors saying that the spare drive was an inoperable unit.

//cps1> info c0

Unit  UnitType  Status         %RCmpl  %V/I/M  Stripe  Size(GB)  Cache  AVrfy
------------------------------------------------------------------------------
u0    RAID-5    OK             -       -       64K     1862.61   ON     OFF
u1    RAID-5    INOPERABLE     -       -       64K     1862.61   OFF    OFF    

Port   Status           Unit   Size        Blocks        Serial
---------------------------------------------------------------
p0     OK               u0     465.76 GB   976773168     WD-WCANU2126397
p1     OK               u0     465.76 GB   976773168     WD-WCANU2051520
p2     OK               u1     465.76 GB   976773168     WD-WCANU2030999
p3     OK               u0     465.76 GB   976773168     WD-WCAS84739115
p4     OK               u0     465.76 GB   976773168     WD-WCANU2114264
p5     OK               u0     465.76 GB   976773168     WD-WCANU2051215
p6     NOT-PRESENT      -      -           -             -
p7     NOT-PRESENT      -      -           -             -
To fix this, I just deleted the unit (u1) and added the disk back as a spare.
//cps1> /c0/u1 del
Deleting /c0/u1 will cause the data on the unit to be permanently lost.
Do you want to continue ? Y|N [N]: Y
Deleting unit c0/u1 ...Done.

Tuesday, March 13, 2012

How to Enable the memcache Extension in php?

MemCached is a high-performance, distributed memory object caching
system, generic in nature, but intended for use in speeding up dynamic
web applications by alleviating database load.

Here i have showed how to install the memcached and extension for php.

1.Install Memcached:

Download the repo from the EPEL.

#rpm -Uhv http://dl.fedoraproject.org/pub/epel/5/i386/epel-release-5-4.noarch.rpm

And use yum to install the memcahed

#yum -y install memcached

After installing you can start the memcached service as follow.

#/etc/init.d/memcached start

2.Install the memcached php extension :

Download The memcached.

#wget http://pecl.php.net/get/memcached

#tar -zxvf memcached

#cd memcache-3.0.6

#phpize && ./configure --enable-memcache && make

#make install

After installing the memcache php enable the extension on php.ini as
follow.

#vim /etc/php.ini

extension="memcache.so"

And restart the httpd server.

Friday, March 2, 2012

How to configure the proftpd as sftp ?

    ProFTPD is a high-performance, extremely configurable, and most of all a secure FTP server, featuring Apache-like configuration syntax, modules, and a highly customizable server infrastructure, including support for multiple ‘virtual’ FTP servers, anonymous FTP, and permission-based directory visibility. Here , i showed, how to configure the proftpd as secure ftp that is sftp for that i have used proftpd-1.3.4a.tar.gz

You can download it from the below link.

root@mughil:~#wget ftp://ftp.proftpd.org/distrib/source/proftpd-1.3.4a.tar.gz

root@mughil:~#tar -zxvf proftpd-1.3.4a.tar.gz

root@mughil:~#cd proftpd-1.3.4a

Run Autoconf(Configure):

Thursday, March 1, 2012

How to Compile and Install Apache from the Source Package?

  Apache provides a facility to extend its functionality using separate modules. Because, When PHP is compiled as Apache shared module its object code is not included in httpd binary. Instead, it works as a separate module which can be loaded by Apache and can also be disabled.So,I have build Apache as shared module.
  You can download the apache from the below url.  http://httpd.apache.org/download.cgi
   Here i have used httpd-2.4.1.tar.bz2

root@mughil:~# cd /usr/src

root@mughil:~# tar -jxvf httpd-2.4.1.tar.bz2

root@mughil:~# cd httpd-2.4.1

Run Autoconf(Configure):

root@mughil:~# ./configure --prefix=/usr/local/apache2/ --enable-mods-shared=all

  Here, prefix option tells the location to install the apache and second option enable-mods-shared tells to compile and install all modules as shared DSO libraries,so that we can easily enable and disable them in the httpd.conf file.

Compiling the Apache:

root@mughil:~# make


Installing the Apache:

root@mughil:~# make install

Wednesday, February 29, 2012

Apache Error – No space left on device: Couldn’t create accept lock

   Sometime Apache (HTTPD) service on a Server stops and while restart it shows following messages in error_logs

[Mon Jan 17 00:18:23 2011] [crit] (28)No space left on device: mod_rewrite: Parent could not create RewriteLock file /usr/local/apache/logs/rewrite_lock Configuration Failed

  Such errors appears when you are running out of Disk Space or Quota which is assigned (which can be increased to fix the issue) OR when semaphores of the server gets full. Semaphores are often used to restrict the number of threads than can access some (physical or logical) resource.

Using the below command you can semaphores list.

root@mughil:~# ipcs -s | grep nobody

  So, In-order to clear the semaphores list. We have execute the following command.

root@mughil:~# ipcs -s | grep nobody | awk '{print $2}' | xargs -n 1 ipcrm sem

Tuesday, February 14, 2012

How to Rebuild 3ware raid?


Rebuild Raid:

Unit  UnitType  Status         %Cmpl  Stripe  Size(GB)  Cache  AVerify  IgnECC
------------------------------------------------------------------------------
u0    RAID-5    DEGRADED       -      64K     1862.61   OFF    ON       OFF      

Port   Status           Unit   Size        Blocks        Serial
---------------------------------------------------------------
p0     DEVICE-ERROR     u0     465.76 GB   976773168     WD-WMASY8103731
p1     OK               u0     465.76 GB   976773168     WD-WMASY8098447
p2     OK               u0     465.76 GB   976773168     WD-WMASY8101621
p3     OK               u0     465.76 GB   976773168     WD-WMASY8102807
p4     OK               u0     465.76 GB   976773168     WD-WMASY8103606
p5     NOT-PRESENT      -      -           -             -
p6     NOT-PRESENT      -      -           -             -
p7     NOT-PRESENT      -      -           -             -
Replaced disk in p0.
//cps2> info c2

Unit  UnitType  Status         %Cmpl  Stripe  Size(GB)  Cache  AVerify  IgnECC
------------------------------------------------------------------------------
u0    RAID-5    DEGRADED       -      64K     1862.61   OFF    ON       OFF      

Port   Status           Unit   Size        Blocks        Serial
---------------------------------------------------------------
p0     OK               -      465.76 GB   976773168     WD-WCASY7466065
p1     OK               u0     465.76 GB   976773168     WD-WMASY8098447
p2     OK               u0     465.76 GB   976773168     WD-WMASY8101621
p3     OK               u0     465.76 GB   976773168     WD-WMASY8102807
p4     OK               u0     465.76 GB   976773168     WD-WMASY8103606
p5     NOT-PRESENT      -      -           -             -
p6     NOT-PRESENT      -      -           -             -
p7     NOT-PRESENT      -      -           -             -

Basic of 3ware Raid


Raid Fix on Linux:

[~]# ./tw_cli

Unit  UnitType  Status         %RCmpl  %V/I/M  Stripe  Size(GB)  Cache  AVrfy
------------------------------------------------------------------------------
u0    RAID-5    OK             -       -       64K     1629.74   ON     OFF

Port   Status           Unit   Size        Blocks        Serial
---------------------------------------------------------------
p0     OK               u0     233.76 GB   490234752     WD-WCANY2312070
p1     OK               u0     233.76 GB   490234752     WD-WCANY2311250
p2     DEVICE-ERROR     u0     233.76 GB   490234752     WD-WCANY1796905
p3     OK               u0     233.76 GB   490234752     WD-WCANY2265331
p4     OK               u0     233.81 GB   490350672     WD-WCAT1A636279
p5     OK               u0     233.81 GB   490350672     WD-WMAYP3458409
p6     OK               u0     233.76 GB   490234752     WD-WCANY2312032
p7     OK               u0     233.81 GB   490350672     WD-WCAT1H074670

//EDGWIN> maint remove c0 p2
Removing port /c0/p2 ... Done.

//EDGWIN> info c0

Sunday, February 12, 2012

How to install mod_evasive module for apache?


    mod_evasive is an evasive maneuvers module for Apache to provide evasive action in the event of an HTTP DoS or DDoS attack or brute force attack. It is also designed to be a detection and network management tool, and can be easily configured to talk to ipchains, firewalls, routers, and etc…
    Detection is performed by creating an internal dynamic hash table of IP Addresses and URIs, and denying any single IP address from any of the following:

  • Requesting the same page more than a few times per second
  • Making more than 50 concurrent requests on the same child per second
  • Making any requests while temporarily blacklisted (on a blocking list)

Installation Procedure:

# cd /usr/local/src

# wget http://fossies.org/unix/www/apache_httpd_modules/mod_evasive_1.10.1.tar.gz

# tar -xzvf mod_evasive_1.10.1.tar.gz ; cd mod_evasive*

# apxs -cia mod_evasive20.c

  Now add the mod_evasive configuration to your Apache configuration file httpd.conf  as below

LoadModule evasive20_module /usr/lib/httpd/modules/mod_evasive20.so

 mod_evasive configuration:

<IfModule mod_evasive20.c>
DOSHashTableSize 3097
DOSPageCount 2
DOSSiteCount 50
DOSPageInterval 1
DOSSiteInterval 1
DOSBlockingPeriod 60
DOSEmailNotify someone@somewhere.com
</IfModule>

# /etc/init.d/httpd restart

Sunday, January 22, 2012

How to backup the file and directory using rsync?

  Rsync is a fast and extraordinarily versatile file copying tool. It can copy locally, to/from another host over any remote shell, or to/from a remote rsync daemon.

Some Examples of rsync :

1.Synchronize Two Directories in a Local Server :

root@mughil:rsync -zvr /source-dir /destination

2.Synchronize Files From Local to Remote

root@mughil:rsync -avz /source username@192.168.200.10:/destination

3.Remote shell for Synchronization

root@mughil:rsync -avz -e ssh username@192.168.200.10:/source /destination

4.Exclude and include in the synchronization

root@mughil:rsync -avz --include 'a*' --exclude '*' username@192.168.200.10:/source /destination

Frequently Used Option in rsync :

-a is archive mode
-d to synchronize only directory tree
-z is to enable compression
-v verbose
-r indicates recursive