Monday, October 14, 2013

11 Tar Command Examples

1. Create tar Archive File
Following command will create a mytest.tar file for a directory "/home/anup/test".

[root@server ~]# tar -cvf mytest.tar /home/anup/test
Description of above options we have used to create .tar file.
c – Creates a new .tar archive file.
v – Verbosely show the .tar file progress.
f – File name type of the archive file. 

2. Create tar.gz Archive File 

To create tar.gz archive file we used option z. [Note: .tar.gz and .tgz both are similar]. 

[root@server ~]# tar -cvzf mytest.tar.gz /home/anup/test OR
[root@server ~]# tar -cvzf mytest.tgz /home/anup/test
3. Create tar.bz2 Archive File

To create highly compressed tar file we use option as j. [Note: tar.bz2 and tar.tbz is similar as tb2]

[root@server ~]# tar -cvjf mytest.tar.bz2 /home/anup/test OR

[root@server ~]# tar -cvjf mytest.tar.tbz /home/anup/test OR

[root@server ~]# tar -cvjf mytest.tar.tb2 /home/anup/test
4. Untar tar Archive File 

Untar files in Current Directory. 
[root@server ~]# tar -xvf mytest.tar

Untar files in specified Directory
[root@server ~]# tar -xvf mytest.tar -C /tmp/

5. Uncompress tar.gz Archive File

Following command will untar .tar.gz file at current location. If you want to untar in different directory then use -C option as we used in above command.

[root@server ~]# tar -xvf mytest.tar.gz

6. Uncompress tar.bz2 Archive File

[root@server ~]# tar -xvf mytest.tar.bz2

7. List Content of .tar / .tar.gz / .tar.bz2 Archive File

[root@server ~]# tar -tvf mytest.tar

[root@server ~]# tar -tvf mytest.tar.gz

[root@server ~]# tar -tvf mytest.tar.bz2

8. Untar Single file from .tar / .tar.gz / .tar.bz2 Archive File
[root@server ~]# tar -xvf mytest.tar test/mytextfile OR
[root@server ~]# tar -xvf --extract --file=mytest.tar test/mytextfile
[root@server ~]# tar -xvzf mytest.tar.gz test/mytextfile OR
[root@server ~]# tar -xvzf --extract --file=mytest.tar.gz test/mytextfile
[root@server ~]# tar -xvjf mytest.tar.bz2 test/mytextfile OR
[root@server ~]# tar -xvjf --extract --file=mytest.tar.bz2 test/mytextfile
9. Untar Multiple files from .tar, .tar.gz and .tar.bz2 Archive File
[root@server ~]# tar -xvf mytest.tar "test/mytextfile1" "test/mytextfile2”

[root@server ~]# tar -xvzf mytest.tar.gz "test/mytextfile1" 
[root@server ~]# tar -xvjf mytest.tar.bz2 "test/mytextfile1" "test/mytextfile2"

10. Untar Single directory from .tar, .tar.gz and .tar.bz2 Archive File
[root@server ~]# tar -xvf mytest.tar test/directoryname

[root@server ~]# tar -xvf mytest.tar.gz test/directoryname

[root@server ~]# tar -xvf mytest.tar.bz2 test/directoryname

11. To see the content of a particular file in .tar / .tar.gz / .tar.bz2 archive without unzipping the contents
[root@server ~]# tar -xvf mytest.tar --to-command=cat test/mytextfile

[root@server ~]# tar -xvf mytest.tar.gz --to-command=cat test/mytextfile

[root@server ~]# tar -xvf mytest.tar.bz2 --to-command=cat test/mytextfile

Monday, September 30, 2013

Install and configure AWStats on CentOS and RHEL System

AWStats (Advanced Web Statistics) is a free powerful and featureful tool that generates advanced web (but also ftp or mail) server
statistics, graphically.

Following are the steps to configure AWStats on CentOS and RHEL system.

1] Download the awstats

[root@server ~]# wget

2] Install awstats

[root@server ~]# rpm -ivh awstats-7.2-1.noarch.rpm
error: Failed dependencies:
    perl(LWP::UserAgent) is needed by awstats-7.2-1.noarch

If you receive above error then install below package :

[root@server ~]# yum install perl-libwww-perl.noarch

Now Again run the command :

[root@server ~]# rpm -ivh awstats-7.2-1.noarch.rpm
Preparing...             ############################## [100%]
   1:awstats              ############################## [100%]

----- AWStats 7.2 - Laurent Destailleur -----
AWStats files have been installed in /usr/local/awstats

If first install, follow instructions in documentation
(/usr/local/awstats/docs/index.html) to setup AWStats in 3 steps:
Step 1 : Install and Setup with (or manually)
Step 2 : Build/Update Statistics with
Step 3 : Read Statistics

3] Now configure and setup AWstats with

[root@server ~]# cd /usr/local/awstats/tools

[root@server tools]# perl
----- AWStats awstats_configure 1.0 (build 1.9) (c) Laurent Destailleur -----
This tool will help you to configure AWStats to analyze statistics for
one web server. You can try to use it to let it do all that is possible
in AWStats setup, however following the step by step manual setup
documentation (docs/index.html) is often a better idea. Above all if:
- You are not an administrator user,
- You want to analyze downloaded log files without web server,
- You want to analyze mail or ftp log files instead of web log files,
- You need to analyze load balanced servers log files,
- You want to 'understand' all possible ways to use AWStats...
Read the AWStats documentation (docs/index.html).

-----> Running OS detected: Linux, BSD or Unix

-----> Check for web server install

Enter full config file path of your Web server.
Example: /etc/httpd/httpd.conf
Example: /usr/local/apache2/conf/httpd.conf
Example: c:\Program files\apache group\apache\conf\httpd.conf
Config file path ('none' to skip web server setup):
> /etc/httpd/conf/httpd.conf    --> Enter Apache configuration path

-----> Check and complete web server config file '/etc/httpd/conf/httpd.conf'
  Add 'Alias /awstatsclasses "/usr/local/awstats/wwwroot/classes/"'
  Add 'Alias /awstatscss "/usr/local/awstats/wwwroot/css/"'
  Add 'Alias /awstatsicons "/usr/local/awstats/wwwroot/icon/"'
  Add 'ScriptAlias /awstats/ "/usr/local/awstats/wwwroot/cgi-bin/"'
  Add '<Directory>' directive
  AWStats directives added to Apache config file.

-----> Update model config file '/etc/awstats/awstats.model.conf'
  File awstats.model.conf updated.

-----> Need to create a new config file ?
Do you want me to build a new AWStats config/profile
file (required if first install) [y/N] ? y

-----> Define config file name to create
What is the name of your web site or profile analysis ?
Example: demo
Your web site, virtual server or profile name:
>                -->  Enter your website name

-----> Define config file path
In which directory do you plan to store your config file(s) ?
Default: /etc/awstats
Directory path to store config file(s) (Enter for default):
>                               --> Press Enter

-----> Create config file '/etc/awstats/'
 Config file /etc/awstats/ created.

-----> Restart Web server with '/sbin/service httpd restart'
Stopping httpd:                                            [  OK  ]
Starting httpd:                                             [  OK  ]

-----> Add update process inside a scheduler
Sorry, does not support automatic add to cron yet.
You can do it manually by adding the following command to your cron:
/usr/local/awstats/wwwroot/cgi-bin/ -update
Or if you have several config files and prefer having only one command:
/usr/local/awstats/tools/ now
Press ENTER to continue...

A SIMPLE config file has been created: /etc/awstats/
You should have a look inside to check and change manually main parameters.
You can then manually update your statistics for '' with command:
> perl -update
You can also read your statistics for '' with URL:
> http://localhost/awstats/

Press ENTER to finish...

4] Now update awstat

[root@server ~]# /usr/local/awstats/wwwroot/cgi-bin/ -update
Error: AWStats database directory defined in config file by 'DirData' parameter (/var/lib/awstats) does not exist or is not writable.
Setup ('/etc/awstats/' file, web server or permissions) may be wrong.
Check config file, permissions and AWStats documentation (in 'docs' directory).

[root@server ~]# mkdir -p /var/lib/awstats

Now configure your website config file:

vi /etc/awstats/


and save the file.

Now Again run the command :

[root@server ~]# /usr/local/awstats/wwwroot/cgi-bin/ -update

5] Add crontab entry to update awstat for every 15 minute.

[root@server ~]# crontab -e
15 * * * * /usr/local/awstats/wwwroot/cgi-bin/ -update

6] Now we configure apache file to enable http based authentication.

Open the httpd.conf file and following lines at the end of file.

[root@server ~]# vi /etc/httpd/conf/httpd.conf

<Directory "/usr/local/awstats/cgi-bin">
  Order allow,deny
  Allow from all

# This is to force authentication when trying to access /awstats

<Location /awstats>
AuthType Basic
AuthName "AWStats Admin Access Required"
AuthUserFile /etc/httpd/conf.d/awstats.passwd
require valid-user

7] Set username and password for awstat link.

[root@server ~]# htpasswd -c  /etc/httpd/conf.d/awstats.passwd admin

8] Restart the httpd.

[root@server ~]# service httpd restart

That's it, access awstats url and check it.

Wednesday, July 17, 2013

How to configure Kickstart Server

Install & Configure PXE Boot Server with Kickstart

1] Install syslinux & tftp-server
[root@server ~]# yum install tftp-server

 2] Enable syslinux at boot time
[root@server ~]# vim /etc/xinetd.d/tftp
edit the line no. 14
disable = no

3] Start service
[root@server ~]# service xinetd start
[root@server ~]# chkconfig xientd on

4] Install FTP service
[root@server ~]# yum install vsftpd

5] Start vsftpd
[root@server ~]# service vsftpd start
[root@server ~]# chkconfig vsftpd on

6] Install syslinux, require boot loader
[root@server ~]# yum install syslinux

7] Copy the needed files from syslinux to the tftpboot directory
[root@server ~]# cp -rvp /usr/share/syslinux/{pxelinux.0,menu.c32,memdisk,mboot.c32,chain.c32} /var/lib/tftpboot/

8] Create the directory for your PXE menus
[root@server ~]# mkdir /var/lib/tftpboot/pxelinux.cfg

9] Create different directory for each PXE image
[root@server ~]# mkdir –p /var/lib/tftpboot/images/centos6

10] Mount CD/DVD and copy it to FTP public directory
[root@server ~]# mount /dev/cdrom /mnt
[root@server ~]# cp -rvp /mnt/* /var/ftp/pub/
[root@server ~]# umount /mnt

11] Copy vmlinuz and initrd.img from FTP public directory
[root@server ~]# cp -rvp /var/ftp/pub/images/pxeboot/{initrd.img,vmlinuz} /var/lib/tftpboot/images/centos6/

12] Instal DHCP server
[root@server ~]# yum install dhcp

13] Configure DHCP server. Add following lines to your /etc/dhcp/dhcpd.conf
[root@server ~]# vi /etc/dhcp/dhcpd.conf
option domain-name "";
option domain-name-servers;
default-lease-time 600;
max-lease-time 7200;

allow booting;
allow bootp;
filename “/pxelinux.0”;

subnet netmask {
        range dynamic-bootp;
    option routers;

14] Start dhcp service
[root@server ~]# service dhcpd start
[root@server ~]# chkconfig dhcpd on

15] Create a menu for PXE server for os selection on PXE loading
[root@server ~]#  vi /var/lib/tftpboot/pxelinux.cfg/default

default menu.c32
prompt 0
timeout 50


LABEL CentOS 6.4 (Final)
KERNEL images/centos6/vmlinuz
append vga=normal initrd=images/centos6/initrd.img ramdisk_size=32768

16] Now create KickStart file in FTP public directory
[root@server ~]# vi /var/ftp/pub/ks.cfg

#It starts the installation process
#configure a connection to a FTP server to locate installation files
url --url
#setup language and keyboard
lang en_US.UTF-8
keyboard us
#Get network info from DHCP server
network --device eth0 bootproto dhcp
#setup encrypted root password, you can take out the encrypted password from /etc/shadow file
rootpw --iscrypted $6$NF6F/Yng442eA8oL$c/sHM
#setup firewall and open ssh port 22
firewall --service=ssh
#sets up the Shadow Password Suite
#(--enableshadow), the SHA 512 bit encryption algorithm for password encryption
#(--passalgo=sha512), and authentication with any existing fingerprint reader.
authconfig --enableshadow --passalgo=sha512 --enablefingerprint
#The selinux directive can be set to --enforcing, --permissive, or --disabled
selinux --enforcing
#setup timezone
timezone America/Toronto
#The default bootloader is GRUB. It should normally be installed on the Master
#Boot Record (MBR) of a hard drive. You can include a --driveorder switch to specify
#the drive with the bootloader and an --append switch to specify commands for
#the kernel.
bootloader --location=mbr --driveorder=sda --append=”crashkernel=auto rhgb quiet”
#Clear the Master Boot Record
zerombr yes
#This directive clears all volumes on the sda hard drive. If it hasn’t been used before,
#--initlabel initializes that drive.
clearpart --all --drives=sda --initlabel
#Changes are required in the partition (part) directives that follow.
part /boot --fstype=ext4 --size=500
part / --fstype=ext4 --size=27500
part swap --size=1000
part /home --fstype=ext4 --size=1000
#reboot machine
#skip answers to the First Boot process
firstboot --disable

 Test the PXE server:
* Make changes in the BIOS settings and boot client machine from network. OR just press F12 to boot from network.

Saturday, July 13, 2013

Install and Configure NRPE in CentOS

 Install NRPE on Linux

NRPE is called as ‘Nagios Remote Plugin Executere’. NRPE allows nagios server
to remotely execute nagios commands or plugins on other Linux/Unix machines. NRPE is also available windows servers.
Following document shows you how to install NRPE, I am installing it on CentOS 6.4

1] Install NRPE required packages.

[root@server ~]# yum install openssl-devel gcc xinetd make

2] NRPE runs under the user "nagios", so let's add that user.

[root@server ~]# useradd nagios

3] Download and install Nagios-plugins.

[root@server downloads]# wget

[root@server downloads]# tar -xvzf nagios-plugins-2.0.tar.gz

[root@server downloads]# cd nagios-plugins-2.0

[root@server nagios-plugins-2.0]# ./configure --with-nagios-user=nagios --with-nagios-group=nagios

[root@server nagios-plugins-2.0]# make install

4] Assign nagios user ownership to nagios commands.

[root@server nagios-plugins-2.0]# chown -R nagios:nagios /usr/local/nagios/libexec

5] Install and configure NRPE nagios client.

[root@server downloads]# wget

[root@server downloads]# tar -xvzf nrpe-2.15.tar.gz

[root@server downloads]# cd nrpe-2.15.tar.gz

[root@server downloads]# ./configure --enable-ssl

[root@server nrpe-2.15]# make all

[root@server nrpe-2.15]# make install-plugin

[root@server nrpe-2.15]# make install-daemon

[root@server nrpe-2.15]# make install-daemon-config

[root@server nrpe-2.15]# make install-xinetd

6] Add following line at the end of file for NRPE in /etc/services

[root@server ~]# vi /etc/services
nrpe            5666/tcp                # NRPE

7] NRPE will run under xinetd daemon. So update xinetd file.

[root@server ~]# vi /etc/xinetd.d/nrpe

# default: on
# description: NRPE (Nagios Remote Plugin Executor)
service nrpe
        flags           = REUSE
        socket_type     = stream
        port             = 5666
        wait            = no
        user            = nagios
        group           = nagios
        server          = /usr/local/nagios/bin/nrpe
        server_args     = -c /usr/local/nagios/etc/nrpe.cfg --inetd
        log_on_failure  += USERID
        disable         = no
        only_from       = --> [ Your Nagios Server IP ]

8] Star/Restart xinetd service.

[root@server ~]# service xinetd start

[root@server ~]# chkconfig xinetd on

Friday, April 19, 2013

Install RED5 server on Linux

Install RED5 server on Linux

Following blog post will describe how to install RED5 server on Centos 5.7 (Final)

Red5 Working :

Red5 server converts the video file to the flash file and we everyone knows that flash files play instantly once someone accesses it. Here when we request or select a particular video, the video script will send the video(stream the video) to red5 server. Red5 will convert the video file to flash and sends the output to the video script to display on the browser. Lot of video scripts are being used now a days like dolphin, videowhisper etc for the site. You can configure the admin panel using the server's IP and port details.

Installation Steps:

1. Download and Install Java:
Red5 is a JAVA server. So install Java using yum.

[root@server ~]# yum -y install java-1.6.0-openjdk java-1.6.0-openjdk-devel

2. Install SVN:
SVN will required to fetch latest release of RED5 source from SVN repository at Google Code.

[root@server ~]# yum install subversion

3. Download and Install Ant & Ivy:
Ant will need to compile RED5 server code. Ant comes in binary form, so just download and install it in /usr/local directory.
First off let’s change to another directory.

[root@server ~]# cd /usr/src
[root@server src]# wget
[root@server src]# tar jxvf apache-ant-1.8.2-bin.tar.bz2
[root@server src]# mv apache-ant-1.8.2 /usr/local/ant

[root@server src]# svn co ivy
[root@server src]# cd ivy
[root@server src]# /usr/local/ant/bin/ant jar
[root@server src]# cp build/artifact/jars/ivy.jar /usr/local/ant/lib/

4. Export Variables for Ant and Java:
So now we have JAVA installed, and ANT is in place. We need to make sure there are some environment variables set. These are global variables with paths to different binaries or applications. ANT and JAVA will need those.

[root@server src]# export ANT_HOME=/usr/local/ant
[root@server src]# export JAVA_HOME=/usr/lib/jvm/java
[root@server src]# export PATH=$PATH:/usr/local/ant/bin

5. Actually Installing the RED5 Server:
Let’s get the RED5 source:

[root@server src]# svn co red5

This will fetch the complete Red5 source and save it in a new folder called, red5 (so in /usr/src/red5)

Now that we have the source, let’s move it to /usr/local/ using

[root@server src]# mv red5 /usr/local/
[root@server src]# cd /usr/local/red5

This is the folder where all the source files reside. From here on, we prepare and build the red5 source.

[root@server red5]# /usr/local/ant/bin/ant prepare
[root@server red5]# /usr/local/ant/bin/ant dist

Wait for few minutes to . After a few minutes you should end up with the last line in your terminal window looking like this:


This means that you now have a working RED5 build!

Copy the conf directory from the dist folder to the current directory and test the red5 installation.

[root@server red5]# cp -r dist/conf .
[root@server red5]# ./

Make sure your server is actually running, you should be able to see the webroot of Red5 when hitting your server at port 5080 (

Note : That the server is currently only running as long as you keep that terminal window open. Once you close it RED5 stops running. Let’s make sure RED5 can run on its own from now on. Hit CTRL+C to stop the process.

6. Init Script:
Now we will create init script for red5 to start, stop and restart easily.

[root@server ~]# vi /etc/init.d/red5 [Enter the following script into vi.]
# For RedHat and cousins:
# chkconfig: 2345 85 85
# description: Red5 flash streaming server
# processname: red5


# Source function library
. /etc/rc.d/init.d/functions

[ -r /etc/sysconfig/red5 ] && . /etc/sysconfig/red5


case "$1" in
echo -n $”Starting $PROG: ”
$DAEMON >/dev/null 2>/dev/null &
if [ $RETVAL -eq 0 ]; then
echo $! > $PIDFILE
touch /var/lock/subsys/$PROG

[ $RETVAL -eq 0 ] && success $”$PROG startup” || failure $”$PROG startup”
echo -n $”Shutting down $PROG: ”
killproc -p $PIDFILE
[ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/$PROG
$0 stop
$0 start
status $PROG -p $PIDFILE
echo $”Usage: $0 {start|stop|restart|status}”

exit $RETVAL

7. Assign execute permission to red5 script.

[root@server ~]# chmod +x /etc/init.d/red5

8. Now start the service

[root@server ~]# service red5 start OR /etc/init.d/red5 start
9. To start RED5 when the server boots.

[root@server ~]# chkconfig --add red5
[root@server ~]# chkconfig red5 on

10. To Install RED5 demos

[root@server ~]# cd /usr/local/red5/webapps/root
[root@server root]# svn checkout

11. Test

Now test the RED5 installation by opening following URL in browser.


Friday, March 29, 2013

Script to find out Linux Hardware Information

How to get Hardware Information on Linux

Simple script to find out Linux Hardware Information.

exec > /root/hard_info 2>&1
echo "Motherboard Model Number"
dmidecode -t baseboard | grep 'Product Name'
echo "===================================="
echo "Processor Information"
dmidecode -t processor | grep 'Socket Designation\|Version:'
echo "===================================="
echo "Memory Type & Size"
dmidecode -t memory | grep 'Type\|Size' | grep -v 'Type Detail\|Error Correction Type'
echo "===================================="
echo "Total Memory"
free -t -m
echo "===================================="
echo "Hard Drive's of Machine"
fdisk -l | grep 'Disk /dev/s'
echo "===================================="
echo "Serial Number of /dev/sda"
hdparm -I /dev/sda | grep 'Model Number:\|Serial Number'
echo "===================================="
echo "Serial Number of /dev/sdb"
hdparm -I /dev/sdb | grep 'Model Number:\|Serial Number'
echo "===================================="

Friday, February 15, 2013

Install Nagios on Linux

Install Nagios on Linux

Nagios is a powerful monitoring system that enables organizations to identify and resolve IT infrastructure problems before they affect critical business processes. Nagios is a popular open source computer system and network monitoring software application. It watches hosts and services, alerting users when things go wrong and again when they get better.

Nagios was designed for use with the Linux operating system, but it will also work under Unix and most Unix-based systems. Nagios runs periodic checks on user-specified resources and services. Resources that can be monitored include memory

Make sure you've
installed the following packages on your Linux installation before continuing.
  • Apache
  • PHP
  • GCC compiler
  • GD development libraries
  • IP =
  • Firewall and Selinux must be disabled.
1] Install gcc compiler, gd development libraries
[root@server ~]# yum install gd gd-devel gcc glibc glibc-common -y

2] Install http package for nagios web-interface
[root@server ~]# yum install httpd php -y

3] Create new user account and assign it password
[root@server ~]# useradd nagios
[root@server ~]# passwd nagios

[ Note = apache user already created ]

4] Create a new nagcmd group for allowing external commands to be submitted through the web interface. Add both the nagios user and the apache user to the group.

[root@server ~]# groupadd nagcmd
[root@server ~]# usermod -G nagcmd nagios
[root@server ~]# usermod -G nagcmd apache

5] Download nagios and plugins from following links.

Create a directory for storing the downloads.
[root@server ~]# mkdir /root/downloads
[root@server ~]# cd /root/downloads

Nagios Download Link =
[root@server downloads]# wget

Plugins Download Link =
[root@server downloads]# wget

6] Now compile and install nagios

[root@server downloads]# tar -xvzf nagios-3.3.1.tar.gz
[root@server downloads]# cd nagios
[root@server nagios]# ./configure --with-command-group=nagcmd
[root@server nagios]# make all

7] Now install bineries, init script
[root@server nagios]# make install
[root@server nagios]# make install-init
[root@server nagios]# make install-config
[root@server nagios]# make install-commandmode

8] Install web config file for nagios web-interface
[root@server nagios]# make install-webconf
[root@server nagios]# cd

9] Create a nagiosadmin account for logging into the Nagios web interface. Remember the password you assign to this account – you’ll need it later.

[root@server ~]# htpasswd -c /usr/local/nagios/etc/htpasswd.users nagios

10] Now compile and install nagios plugins

[root@server ~]# cd /root/downloads
[root@server downloads]# tar -xvzf nagios-plugins-1.4.15.tar.gz
[root@server downloads]# cd nagios-plugins-1.4.15
[root@server nagios-plugins-1.4.15]# ./configure --with-nagios-user=nagios --with-nagios-group=nagios
[root@server nagios-plugins-1.4.15]# make
[root@server nagios-plugins-1.4.15]# make install
[root@server ~]# cd

13] Start nagios service ( Add Nagios to the list of system services and have it automatically start when the system boots. )

[root@server ~]# chkconfig --add nagios
[root@server ~]# chkconfig nagios on

14] Verify the sample nagios configuration file

[root@server ~]# /usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg

15] If there are no error start nagios and httpd (for nagios web-interface)service

[root@server ~]# service nagios start
[root@server ~]# service httpd restart

16] If you done this successfully then login to Nagios Web-interface

[ Note = You should now be able to access the Nagios web interface at the URL below. You'll be prompted for the username (nagiosadmin) and password you specified earlier. ]

URL is = http://<nagios server ip/nagios

Example =

How to install Nagios Arana Theme ?

1] Move old Nagios theme into new folder.

[root@server ~]# mkdir /usr/local/nagios/share/old-theme
[root@server ~]# mv /usr/local/nagios/share/* old-theme

2] Download Arana Theme.

[root@server ~]# cd /usr/local/nagios/share
[root@server share]# wget

[root@server share]# unzip
[root@server share]# cd

3] Restart Nagios.

[root@server ~]# service nagios reload

Sunday, January 06, 2013

RkHunter Installtion

RKHunter [Rootkit Hunter]
RootKit is a feature rich scanning tool that scans for rootkits, backdoors, and local exploits. It scans hidden files, wrong permissions set on binaries, suspicious strings in kernel etc.
As rootkits are installed into system files they cannot be removed easily however, RKHunter will still notify you of any rootkits that may exist in your system so that you can take the necessary steps to reload on server. 

Rootkit Hunter is not a reactive tool: it only enumerates encountered threats.
It is up to you to read the log file and investigate suspicious activity.

To know more about Rkhunter and its features visit

================================== ==============
Installing Rkhunter (Rootkit Hunter) in RHEL, CentOS and Fedora
================================== ==============
Step 1: Downloading Rkhunter:
[root@server ~]# mkdir /download
[root@server ~]# cd /download
[root@server download]# wget

Step 2: Installing Rkhunter:
Once you have downloaded the latest version, run the following commands as a root user to install it.
[root@server download]# tar -xvzf rkhunter-1.4.0.tar.gz
[root@server download]# cd rkhunter-1.4.0
[root@server rkhunter-1.4.0]# ./ --install
[root@server rkhunter-1.4.0]# cd 

Step 3: Updating Rkhunter:
Run the RKH updater to fill the database properties by running the following command.
[root@server ~]# /usr/local/bin/rkhunter --update
[root@server ~]# /usr/local/bin/rkhunter --propupd 

Step 4: Setting Cronjob and Email Alerts:
Create one file " under /etc/cron.daily/, which then scans your file system every day and sends email notifications to your email id. 

[root@server ~]# vi /etc/cron.daily/
#Add the following lines of code to it and replace your “Server Name” and your “Email Id“.
/usr/local/bin/rkhunter --versioncheck
/usr/local/bin/rkhunter --update
/usr/local/bin/rkhunter --cronjob --report-warnings-only
) | /bin/mail -s 'rkhunter Daily Run (' 

Set execute permission on the file.
[root@server ~]# chmod +x /etc/cron.daily/ 

Step 5: Manual Scan and Usage:
To scan the entire file system, run the Rkhunter as a root user.
[root@server ~]# rkhunter --check
The above command generates log file under /var/log/rkhunter.log with the checks results made by Rkhunter. 

For more information and options please run the following command.
[root@server ~]# rkhunter --help