Sunday, August 11, 2013

Kick Start Installation in Linux


Kick Start Installation


  • Linux allows you to do operating System installations via a network connection using a kick-start Server.
  • It is frequently much faster than Using CDs and the process can be automated.
  • The kick-start server creates an answer File
  • Kick-start can be configured on an FTP, NFS or Apache server.
  • The kick Start installation method is Called as Network Based Installation

Requirements For configuring Kick Start Server :

  • A computer with Red Hat Linux Enterprise Server O.S
  • The PC must configure with static IP Address (192.168.5.1)
  •  Linux Server must configure DHCP Server
  •  Linux Server must configure with FTP Server / NFS Server / Apache Web Server

Steps For Configuring Kick Start Server for FTP based Installation :


  • Step1 : Configure IP Address as “192.168.5.1”
  • Step2 : Install and Configure DHCP Server
  • Step3 : Install and Configure “VSFTPD” for the FTP Server
  • Step4 : Copy all RPM files from Linux DVD to “/var/ftp/pub/Server” directory
  • Step5 : Install “System-config-kick-start” RPM package
  • Step6 : Create “Kick start configuring file by running “system-config-kickstart” command
  • Step5: Install “system-config-kickstartrpm package
  • Insert Linux DVD
  • [root@mylinuxpc1 ~]# cd /media/CDROM/Server/
  • [root@mylinuxpc1 Server]#
  • [root@mylinuxpc1 Server] # pwd
  • /media/CDROM/Server
  • [root@mylinuxpc1 Server]#
  • [root@mylinuxpc1 Server]# rpm -Uvh system-config-kickstart-2.6.19.1-1.el5.noarch.rpm
  • Preparing... ########################################### [100%]
  • 1:system-config-kickstart ################################## [100%]
  • [root@mylinuxpc1 Server]#



  • Step6 : Create “Kick start configuring file by running “system-config-kickstart” command
[root@mylinuxpc1 Server]# system – config – kickstart
Select “Basic Configuration” option
Type Root Password “xxxxxx” and type Confirm password “xxxxxx”
Select The check box “Reboot the system after installation”

             Select “Installation Method” – Select “Perform new Installation” – Select “FTP”

Type FTPServer IP address as “192.168.5.1” and FTP Directory as “/pub

Select “Boot Loader Options” – Select “ Install new boot loader
Select “Partition Information” – Select “Clear Master Boot Record”
Select “Remove all existing partitions” – Click on “Add” for creating partitions


Select Mount Point “/boot”
Type Size “100”
Click On “OK”


Select Mount Point “/”
Type Size “6000”
Click on “OK”

Select “File System Type”
Select swap
Type Size “1000”
Click on “OK”


Select “Network Configuration” – Click on “Add”
Select Network Device “eth0” – Select Network Type “DHCP” – Click on “OK”


Select “Authentication” option
Select the check box “Use Shadow Passwords”
Select the check box “Use MD5”


Select “Firewall Configuration” option
Select “Security level “Disabled” – Select SELinux “Disabled”


Select “Display Configuration” option
Select Resolution “800x600” or “1024x768”


Select Default Desktop “GNOME
Select “Package Selection” option
                                               Select the Required Packages


Leave “Pre-Installation Script” option and Leave “Post-Installation Script” option
Click on “File” menu – Click on “Save File”



Type Name of the file as “ksftp.cfg”
Select the location “/var/ftp/pub” directory
Click on “Save”


Steps for Installing Linux O.S by using Kickstart / Network Based :
Client Computer :
  1. A computer with HDD , LAN Card and DVD Drive
Insert Linux DVD in the client computer DVD Drive
Change the first boot device as “CDROM” in the BIOS Setup
Start the computer
You will get like
boot : type the following command
boot : linux ks =ftp://192.168.5.1/pub/ksftp.cfg


After booting Remove Linux DVD
Now Automatic Linux Installation will start , with out asking any options

Wednesday, August 7, 2013

How to install Observium in Linux





              How to install Observium in Linux?


Observium is one of the best tool ever used by system network admin for monitoring everything about routers, switches and physical machines etc.

Please follow the following working steps to get Observium installed.

1. install ncecessary packages for Observium
# yum install httpd php php-mysql php-gd php-snmp vixie-cron php-pear net-snmp net-snmp-utils graphviz subversion mysql-server mysql rrdtool fping ImageMagick jwhois nmap OpenIPMI-tools

2. install pear
# pear install Net_IPv6
# pear install Net_IPv4

3. # yum install libvirt

4. # mkdir /opt/observium
# cd /opt

5. #svn co http://www.observium.org/svn/observer/trunk observium

6. # cd observium

7. Create mysql username and password
# mysqladmin -u root password 'passworD321'
mysql> create database observium;
Query OK, 1 row affected (0.00 sec)
mysql>grant all privileges on observium. * to 'observium'@'localhost' identified by 'passworD321';
Query OK, 0 rows affected (0.00 sec)

8. # cp config.php.default config.php

9. vi config.php and add the following part.
$config['fping'] = "/usr/sbin/fping";

# php includes/sql-schema/update.php

10. # mkdir graphs rrd

11. chown apache.apache graphs rrd

12. Edit in httpd config file:
# vi /etc/httpd/conf.d/observium.conf
<VirtualHost *:80>
DocumentRoot /opt/observium/html/
ServerName observium.domain.com
CustomLog /opt/observium/logs/access_log combined
ErrorLog /opt/observium/logs/error_log
<Directory "/opt/observium/html/">
AllowOverride All
Options FollowSymLinks MultiViews
</Directory>
</VirtualHost>

13. Create logs directory for apache
# mkdir /opt/observium/logs
# chown apache.apache /opt/observium/logs

14. Add user, use level of 10 for admin
# cd /opt/observium
# ./adduser.php <user-name> <password> <level=10>

15. Add a first device to monitor:
# ./addhost.php <hostname> <community> v2c

16. Discover and add hosts
# ./discovery.php -h all
# ./poller.php -h all

17. Add to cronjobs
33 */6 * * * /opt/observium/discovery.php -h all >> /dev/null 2>&1
*/2 * * * * /opt/observium/discovery.php -h new >> /dev/null 2>&1
*/2 * * * * /opt/observium/poller.php -h all >> /dev/null 2>&1
and restart the cron
# /etc/init.d/cron reload

18. In case if server rebooted, add to startup
# chkconfig mysqld on
# chkconfig httpd on

Now check,on your browser as http://localhost/observium with the username and password we have created. 

Sample Observium output graph details  in given below.

 


Thursday, June 27, 2013

How to Configure Kdump in Centos 5.6




Kdump is a reliable kernel crash dumping mechanism. Kdump uses kexec to boot into the second kernel whenever the system crashes.
Kexec is a fastboot mechanism which allows booting a Linux kernel from the context of an already running kernel without going through the BIOS.

Kindly find the step-by-step installation steps:


  1. Download kernel-debuginfo-common and kernel-debuginfo RPMs for your kernel version
  2. (uname -r)
    2.6.18-274.el5
  3. Install kernel-debuginfo-common and kernel-debuginfo on the system:
    # ls *.rpm
    kernel-debuginfo-2.6.18-274.el5.x86_64.rpm  kernel-debuginfo-common-2.6.18-274.el5.x86_64.rpm
    # rpm -ivh *.rpm
    warning: kernel-debuginfo-2.6.18-274.el5.x86_64.rpm: Header V3 DSA signature: NOKEY, key ID 37017186
    Preparing...                ########################################### [100%]
     1:kernel-debuginfo-common########################################### [ 50%]
     2:kernel-debuginfo       ########################################### [100%]
  4. Also install kexec-tools and crash:
    # yum install kexec-tools crash
  5. Append "crashkernel=128M@16M" to the kernel parameters in
    vim /etc/grub.conf:
    # grubby --update-kernel=ALL --args="crashkernel=128M@16M"
  6. Reboot
  7. Check that the crash kernel has been loaded:
    # cat /proc/iomem | grep Crash\ kernel
     01000000-08ffffff : Crash kernel
  8. Configure kdump via the following command:
    # echo > /etc/kdump.conf << EOF
    net root@kdump_remote_server
    core_collector makedumpfile -d 31 -c
    EOF
  9. Propagate SSH keys so that the vmcore could be sent via scp without the need to enter any password:
    # service kdump propagate
  10. Create kdump ramdisk for collecting the vmcore
    # service kdump restart
  11. Sync all filesystems:
    # sync
  12. Provoke a kernel panic with:
    # echo "1" > /proc/sys/kernel/sysrq
    # echo "c" > /proc/sysrq-trigger
  13. Now the crash kernel should get booted and on the remote system a vmcore should get created under /var/crash:
    # tree /var/crash
    /var/crash
    |-- 192.168.12.227-2010-01-21-20:16:16
     `-- vmcore.flat
  14. The vmcore.flat needs to be processed in order to analyze the core dump via the crash utility:
    # cat "vmcore.flat" | makedumpfile -R "/tmp/linuxjyot"
    The dumpfile is saved to /tmp/linuxjyot.
    makedumpfile Completed.
  15. Now you may analyze the vmcore with the crash utility:
    # crash /usr/lib/debug/lib/modules/2.6.18-274.el5/vmlinux /tmp/linuxjyot 
    crash 4.0-8.9.1.el5
    Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009  Red Hat, Inc.
    Copyright (C) 2004, 2005, 2006  IBM Corporation
    Copyright (C) 1999-2006  Hewlett-Packard Co
    Copyright (C) 2005, 2006  Fujitsu Limited
    Copyright (C) 2006, 2007  VA Linux Systems Japan K.K.
    Copyright (C) 2005  NEC Corporation
    Copyright (C) 1999, 2002, 2007  Silicon Graphics, Inc.
    Copyright (C) 1999, 2000, 2001, 2002  Mission Critical Linux, Inc.
    This program is free software, covered by the GNU General Public License,
    and you are welcome to change it and/or distribute copies of it under
    certain conditions.  Enter "help copying" to see the conditions.
    This program has absolutely no warranty.  Enter "help warranty" for details.
     
    GNU gdb 6.1
    Copyright 2004 Free Software Foundation, Inc.
    GDB is free software, covered by the GNU General Public License, and you are
    welcome to change it and/or distribute copies of it under certain conditions.
    Type "show copying" to see the conditions.
    There is absolutely no warranty for GDB.  Type "show warranty" for details.
    This GDB was configured as "x86_64-unknown-linux-gnu"...
     KERNEL: /usr/lib/debug/lib/modules/2.6.18-274.el5/vmlinux
     DUMPFILE: /tmp/linuxjyot  [PARTIAL DUMP]
     CPUS: 1
     DATE: Thu Jan 21 20:21:20 2010
     UPTIME: 00:03:10
    LOAD AVERAGE: 1.09, 0.46, 0.17
     TASKS: 445
     NODENAME: vrhel03
     RELEASE: 2.6.18-274.el5
     VERSION: #1 SMP Wed Apr 29 13:53:08 EDT 2009
     MACHINE: x86_64  (2666 Mhz)
     MEMORY: 1 GB
     PANIC: "SysRq : Trigger a crashdump"
     PID: 7835
     COMMAND: "bash"
     TASK: ffff81040699d0c0  [THREAD_INFO: ffff8103fed24000]
     CPU: 1
     STATE: TASK_RUNNING (SYSRQ)
    crash>


For refernce: Some Copied from below link:

Wednesday, June 26, 2013

Logwatch 7.40 as this has built in MySQL PHP and HTTP Error Logging

Logwatch 7.40 as this has built in MySQL PHP and HTTP Error Logging

 

Install Logwatch 7.40 as this has built in MySQL PHP and HTTP Error Logging

Today I have installed/configured Logwatch application in Centos "Logwatch parses through your system's logs and creates a report analyzing areas that you specify. Logwatch is easy to use and will work right out of the package on most systems."


Its most powerful tools.
Download the RPM :
1wget http://downloads.sourceforge.net/project/logwatch/logwatch-7.4.0/logwatch-7.4.0-1.noarch.rpm
Install it:
1rpm -Uvh logwatch-7.4.0-1.noarch.rpm
or I like to use
1yum install logwatch-7.4.0-1.noarch.rpm
If you don't need MySQL, PHP or HTTP Error Log checking you can just install version 7.3 by using
1yum install logwatch
This will install Logwatch and also create a cronjob in the /etc/cron.daily folder.

2. Basic Configurations and Mail to Email

Now, we need to change a couple of settings within the Logwatch configuration file.
The file is located at /usr/share/logwatch/default.conf/logwatch.conf. Using your text editor open the configuration file and find the following:
1vim /usr/share/logwatch/default.conf/logwatch.conf
Find and change:
1Output = stdout
To
1Output = mail
And
1MailTo = root
To
1MailTo = youremail@yourserver.com
You can also change the Range or Detail levels:
1Range = Yesterday 
To All, Today or Yesterday, bet yesterday should work best
1Detail = Low
To Low = 0  MED = 5  or High = 10

3. Disable unneeded service monitoring

Now we need to disable some unneeded service monitoring – we can do this only if we have the Service setting set to All like so:
1Service = All 
To disable the monitoring of some services simply adds this below that line to disable postfix:
1Service = "-postfix"
or clamav for example
1Service = "-clamav"

4. Enable MySQL PHP and HTTP-Error log monitoring

This step took me a while to get working on CentOS 6 but here is how to do it.
First test if logwatch is working by simply running
1logwatch
Check your email to see what outputs you get, if everything works you can skip the rest!
If you are missing the MSQL and HTTP-ERROR outputs:
You could run this command to get a more detailed email and any debug info.
1logwatch --detail high --range all --debug 5
This command is also good for debugging specific services
1logwatch --detail high --service http-error --range yesterday --debug 5
Run these commands and check the output to see the debug output, then check your email to see the emailed output.
You could also run a specific service with the specific log file to see if it's working:
1cat /var/log/mysqld.log | perl /usr/share/logwatch/scripts/services/mysql
On my CentOS 6 I could not get any MySQL or HTTP-Error outputs so this is how I went about fixing it.
1. Run a specific service with the specific log file to see if it's working:
1cat /var/log/mysqld.log | perl mysql
I got this error
1Can't locate Logwatch.pm in @INC (@INC contains: /usr/local/lib/perl5 /usr/local/share/perl5 /usr/lib/perl5/vendor_perl /usr/share/perl5/vendor_perl /usr/lib/perl5 /usr/share/perl5 .) at mysql line 30.
2BEGIN failed--compilation aborted at mysql line 30.
A simple symbolic link fixed that issue:
1ln -s /usr/share/logwatch/lib/Logwatch.pm /usr/local/lib/perl5/Logwatch.pm
After that the command would give me a nice output with some errors:
1cat /var/log/mysqld.log | perl mysql 
2Errors:
311 times:
4[120310 03:43:11 ±1 day(s)] Could not use /var/log/mysql/slow-queries.log for logging (error 2). Turning logging off for the whole duration of the MySQL server process. To turn it on again: fix the cause, shutdown the MySQL server and restart it.
2. Then we need to  Run this command to debug and check the specific services
1logwatch --detail high --service mysql --range all --debug 5
 I got this output
1export LOGWATCH_DATE_RANGE='all'
2export LOGWATCH_GLOBAL_DETAIL='10'
3export LOGWATCH_OUTPUT_TYPE='mail'
4export LOGWATCH_FORMAT_TYPE='text'
5export LOGWATCH_TEMP_DIR='/var/cache/logwatch/logwatch.jApI_bRi/'
6export LOGWATCH_DEBUG='5'
This meant that it did not process the log files
To fix this we need to fix the log file location for MYSQL
1vim /usr/share/logwatch/default.conf/logfiles/mysql.conf
Change the path to your specific mysql error log path
ie - /var/log/mysqld.log
After we fix that we can run the command again and see that it's working – you should also get a nice email with the MYSQL error output.
1logwatch --detail high --service mysql --range all --debug 5
You should see this output:
1export LOGWATCH_DATE_RANGE='all'
2export LOGWATCH_GLOBAL_DETAIL='10'
3export LOGWATCH_OUTPUT_TYPE='mail'
4export LOGWATCH_FORMAT_TYPE='text'
5export LOGWATCH_TEMP_DIR='/var/cache/logwatch/logwatch.jApI_bRi/'
6export LOGWATCH_DEBUG='5'
7Preprocessing LogFile: mysql
8'/var/log/mysqld.log' | /usr/bin/perl /usr/share/logwatch/scripts/shared/expandrepeats ''>/var/cache/logwatch/logwatch.jApI_bRi/mysql
9Processing Service: mysql
10 ( cat /var/cache/logwatch/logwatch.jApI_bRi/mysql | /usr/bin/perl /usr/share/logwatch/scripts/services/mysql) 2>&1
For the HTTP-Error service there was a different fix:
When we ran:
1logwatch --detail high --service http-error --range all --debug 5
We would see:
1Preprocessing LogFile: http-error
BUT NOT!!!
1Processing Service: http-error
To fix this I had to remove *ApplyhttpDate from /usr/share/logwatch/default.conf/logfiles/http-error.conf
1vim /usr/share/logwatch/default.conf/logfiles/http-error.conf
And comment out the *ApplyhttpDate line on the bottom like so
1# Keep only the lines in the proper date range...
2#*ApplyhttpDate
Now the HTTP-Error Service would give me the correct debug output and a nice email.


Sample Logwatch Output logs in given below.
  • LOGWATCH Summary
  • System Configuration
  • httpd
  • http errors
  • pam_unix
  • postfix
  • sendmail-largeboxes (large mail spool files)
  • SSHD
  • XNTPD
  • Disk Space
  • Network Report

LOGWATCH Summary

      Logwatch Version: 7.4.0 (03/01/11)
      Processing Initiated: Tue Jun 25 15:26:38 2013
      Date Range Processed: today
                            ( 2013-Jun-25 )
                            Period is day.
      Detail Level of Output: 0
      Type of Output/Format: mail / html
      Logfiles for Host: test.example.com

System Configuration

No Sys::CPU module installed.  To install, execute the command:
  perl -MCPAN -e 'install Sys::CPU'

No Sys::MemInfo module installed.  To install, execute the command:
  perl -MCPAN -e 'install Sys::MemInfo'

  Machine: x86_64
  Release: Linux 2.6.18

httpd


Requests with error response codes
  403 Forbidden
     http://www.test.com/: 1 Time(s)
     http://www.google.com/: 1 Time(s)
  404 Not Found
     http://server6.test.net/azenv.php: 1 Time(s)

http errors

Errors:

1 times:
[... Jun 25 08:56:37 2013] [client 10.0.0.12 Directory index forbidden by Options directive: /var/www/html/

pam_unix

su-l:
  Authentication Failures:
     test(500) -> root: 2 Time(s)
  Sessions Opened:
    root -> root: 5 Time(s)

postfix

STATISTICS
----------

842803 bytes transferred
386 messages accepted for queue
386 messages removed from queue

DETAILS


Local Bounces: 1, 378 Time(s)









Unrecognized warning:
   backward time jump detected -- slewing clock : 2 Time(s)
   backward time jump recovered -- back to normality : 2 Time(s)

sendmail-largeboxes (large mail spool files)

Large Mailbox threshold: 40MB (41943040 bytes)
Warning: Large mailbox: root (143990521)

SSHD


Users logging in through sshd:
  dlrbase:
     10.0.0.1 (NSG-St.test.in): 6 times

Refused incoming connections:
     150.0.0.15 (150.0.0.15 ): 1 Time(s)
    145.0.0.22 (145.0.0.22): 24 Time(s)

XNTPD


Time Reset 8 times (total: -7.381299 s  average: -0.922662 s)

Total synchronizations 47 (hosts: 3)

Errors
 no servers reachable: 27 time(s)

Disk Space

Filesystem            Size  Used Avail Use% Mounted on
/dev/sda3             47G   17G  30G  21% /
/dev/sda1             12M   12M  104M  11% /boot

Network Report



------------- Network Interfaces ---------------

Ethernet : 2
Other    : 1
Total    : 3


------------- Ethernet -------------------------

eth0      Link encap:Ethernet  HWaddr 00:16:36:12:43:AS 
eth1      Link encap:Ethernet  HWaddr 00:WE:12:65:HH:LH


------------- Other ----------------------------

lo        Link encap:Local Loopback  


------------- Network Interfaces ---------------




------------- Network statistics ---------------

1: lo: <LOOPBACK,UP,LOWER_UP> mtu 16436 qdisc noqueue
   link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
   inet 127.0.0.1/8 scope host lo
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast qlen 1000
   link/ether 00:16:12:hh:re brd ff:ff:ff:ff:ff:ff
   inet 192.168.1.21/24 brd 192.168.1.255 scope global eth0
3: eth1: <BROADCAST,MULTICAST> mtu 1500 qdisc noop qlen 1000
   link/ether 00:16:31:12:rd brd ff:ff:ff:ff:ff:ff

Iface        MTU RX-ERR TX-ERR
eth0       1500      0      0
lo      16436      0      0


------------- Network statistics ---------------


Logwatch Ended at Tue Jun 25 15:27:47 2013