nothing is impossible!!!!

nothing is impossible!!!!

Tuesday, June 15, 2010

firefox and java plugin on linux

1. Download jre-6u20-linux-x64.bin

2. ./jre-6u20-linux-x64.bin

3. ln -s /tmp/jre1.6.0_21/lib/amd64/libjavaplugin_jni.so /usr/lib/mozilla/plugins/libjavaplugin.so

4. ls -al /usr/lib/mozilla/plugins/libjavaplugin.so

Monday, June 14, 2010

update rhel4 packages

You can use "update -u" to update the packages on RHEL4.

If it does not give you any indication of package updation try to clear cache (rm -rf /var/spool/up2date/*) and fire above command again.

Even if above method doesnt work. Login to your respective rhn satellite.
1. Select Critical, Non-critical packages.
2. Select All.
3. at the bottom, select update packages
4. then confirm.
5. ssh to the respective system, and run "rhn_update -vvv". It should show updating package details.

Monday, April 26, 2010

Good article on iscsi

http://www.idevelopment.info/data/Unix/Linux/LINUX_ConnectingToAniSCSITargetWithOpen-iSCSIInitiatorUsingLinux.shtml#About%20the%20Author

Thursday, April 15, 2010

How to select specific storage ?

What is largest amount of data do you manage?

How much data is significant for you?

have you planned about deletion of data?

how ofter will you delete data? schedule?

Who is gone access your data? ex. applications, servers ?

are you planning to host your applications as well?

how must data application gone consume?

how much your application data may grow?

How busy will be your storage?

applications future plans?

How much data may grow in future?

If data not available, how does unavailability cost your org?

are you planning to archive data?

Why do you want to archive data?

how ofter are you planning to archive data?

for how long will you keep archive data?

existing data managements issues?

data center to manage data storage equipment?

Enough space in datacenter?

Tuesday, April 13, 2010

kickstart fully automatic installtion for rhel

Note: Please remember options may vary depend on OS, network settings, os update version etc.

This fully automatic installation cfg is for RedHat 5 OS.

install
text
nfs --server=192.168.1.9 --opts=tcp --dir=/pub/rhel/released/RHEL-5-Client/U5/i386/os
keyboard us
lang en_US
key --skip
reboot --eject
selinux --disabled
firewall --disabled
rootpw redhat

timezone --utc Asia/Kolkata
network --onboot yes --bootproto dhcp --gateway 192.168.1.1 --nameserver 192.168.1.10


#Setup default services
services --disabled=cups,messagebus,ip6tables,isdn,pcmcia,hidd,bluetooth --enabled=ntpd,nscd

# Disk Setup

bootloader --location=mbr --append="rhgb console=tty0 console=ttyS0,9600"
clearpart --all

# auto disk partition
part /boot --fstype ext3 --size=100
part swap --fstype swap --size=2048
part pv.1 --size=0 --grow
volgroup AutoVolGroup pv.1
logvol / --vgname=AutoVolGroup --name=root --size=1 --grow

%packages
@core
@system-tools

%post
cat <> /etc/motd
Lab automatic kickstart installation.
Installed `date`
EOF
cat /etc/motd >> /root/ks.cfg

Wednesday, April 7, 2010

disable selinux on the fly

To disable selinux on the fly you should run following command in terminal,
setenforce 0

to disabled it permanently, open /etc/selinux/config and change value to SELINUX=disabled

Friday, February 19, 2010

How to upgrade firmware on Dell DRAC?

DRAC stands for Dell Remote Access Controller. The DRAC on current models is a separate chipset and board that is connected to the server main board with its own network interface as well as a direct configuration accessible during system initialization.

DRAC has a default TCP/IP address and can be change during system initialization

I found dmidecode currently does not return any information about DRAC card on the system. If you have system tag with you can check online if systems include DRAC card.
* Put you system tag here,
http://support.euro.dell.com/support/topics/topic.aspx/emea/shared/support/my_systems_info/en/details?c=uk&l=en&s=gen
* Click on "Original System configuration"
* Search for "DRAC"

Here is firmware upgrade process.

* Download the firmware for your system, In my case it was Power Edge 2950 system. I found firware versions here.

* Download windows zipped exe file and extract it.There should be only one file named "firmimg.d5".

* Copy the same to your tftp server at /tftpboot/pxelinux.cfg/ location. (Can share it and mount on tftpserver or use WinSCP to copy files to remote unix system)

* Login to drac server using the IP assigned to DRAC.
Before upgradation firmware version

[root@npatil ~]# ssh drac-ip
root@drac-ip's password:

Dell Remote Access Controller 5 (DRAC 5)
Firmware Version 1.0 (Build 06.05.12)

$ racadm fwupdate -g -u -a tftpserver-ip-address -d firmimg.d5
Firmware update completed successfully. The RAC is in the process of
resetting. Please wait up to a minute for this to complete.



Please do not make any changes in DRAC configuration while doing firmware upgradation.

It may disturb upgrade process.

After upgradation Firmware Version

[root@npatil ~]# ssh drac-ip
root@drac-ip's password:

Dell Remote Access Controller 5 (DRAC 5)
Firmware Version 1.20 (Build 07.03.02)

Sunday, February 7, 2010

SAN terminologies

Here I am trying to put every definition related to SAN on single page. Its a collective information from different sites.

AoE: ATA over Ethernet: its a network protocol designed to access SATA storage devices over the Ethernet networks. AoE does not rely on network layers above Ethernet, such as IP and TCP.
The advantage of AoE is that you don't have the overhead of translating ATA to SCSI and then back to ATA (if you are using ATA drives). So there is a performance pickup.

NBD: The Linux Network Block Device (NBD) is a device driver extension to the Linux kernel. With the NBD device driver you can create a TCP/IP network connection between your local Linux system and a server program on a remote (not necessarily Linux) computer. But NBD has some limitations in terms of read/write operation and using NBD as a root file system.
Server processing load for iSCSI is much higher than AoE for equivalent throughput. AoE can spare processing cycles. iSCSI requires TCP/IP and its requisite complexity.

ENBD- Enhanced Network Block Device
GNBD- Global Network Block Device


WWPN: World Wide Port Name. A globally unique identifier for a port which allows certain applications to access the port. The FC switches discover the WWPN of a device or host and assign a port address to the device.

Multipathing: When transferring data between the host server and storage, the SAN uses a multipathing technique. Multipathing allows you to have more than one physical path from the Server host to a LUN on a storage array.
If a default path or any component along the path—HBA, cable, switch port, or storage processor—fails, the server selects another of the available paths. The process of detecting a failed path and switching to another is called path failover.


An active/active disk array, which allows access to the LUNs simultaneously through all the storage processors that are available without significant performance degradation. All the paths are active at all times (unless a path fails).

An active/passive disk array, in which one SP is actively servicing a given LUN. The other SP acts as backup for the LUN and may be actively servicing other LUN I/O. I/O can be sent only to an active processor. If the primary storage processor fails, one of the secondary storage processors becomes active, either automatically or through administrator intervention.

Monday, October 26, 2009

Wednesday, September 16, 2009

how to configure APC pdu using minicom.

Prerequisite:

PDU installation with proper network and console connection.


Configuration:
1. Run minicom -s -c on
-s - Setup. It has different option to setup your console. It edits /etc/minirc.dfl which is default to store configuration.
-c It usage color's on console.

Note: you can even run only "minicom -s"

Your screen should be like this,

┌─────[configuration]───-──┐
│ Filenames and paths │
│ File transfer protocols │
│ Serial port setup │
│ Modem and dialing │
│ Screen and keyboard │
│ Save setup as dfl │
│ Save setup as.. │
│ Exit │
│ Exit from Minicom │
└──────────────────-─┘


2. Select serial port setup option to select connect to correct serial device. I have terminated serial console cable from PDU to my Linux box so my device was /dev/ttyS0

It may differ depend on OS.

┌────────────────────────────────────┐
│ A - Serial Device : /dev/ttyS0 │
│ B - Lockfile Location : /var/lock │
│ C - Callin Program : │
│ D - Callout Program : │
│ E - Bps/Par/Bits : 9600 8N1 │
│ F - Hardware Flow Control : No │
│ G - Software Flow Control : No │
│ │
│ Change which setting? │
└────────────────────────────────────┘


3. I had to set Hardware Flow Control to No as it was Yes by default.

4. Choose Save setup as dfl to save the configuration. By default it save configuration in /etc/minirc.dfl. Here is my minirc.dfl.

# Machine-generated file - use "minicom -s" to change parameters.
pr port /dev/ttyS0
pu baudrate 9600
pu bits 8
pu parity N
pu stopbits 1
pu rtscts No


5. Once you save and exit from the setup. It intitialize the serial console and gives you access to PDU. The next screen would be something like this,

Welcome to minicom 2.1


OPTIONS: History Buffer, F-key Macros, Search History Buffer, I18n
Compiled on Jul 26 2006, 06:38:09.


Press CTRL-A Z for help on special keys

User Name : apc
Password : ***



6. Default username and password for apc PDU's are apc/apc.

American Power Conversion Network Management Card AOS v3.7.0
(c) Copyright 2008 All Rights Reserved Rack PDU APP v3.7.0
----------------------------------------------------------------------------------------------------------
Name : Engineering Rack PDU Date : 29.03.2000
Contact : Nilesh Patil Time : 19:23:22
Location : Server Room 1 User : Administrator
Up Time : 0 Days 5 Hours 0 Minutes Stat : P+ N+ A+


Switched Rack PDU: Communication Established

------- Control Console -------------------------------------------------------

1- Device Manager
2- Network
3- System
4- Logout


- Main Menu, - Refresh, - Event Log
>


7. Select 2-Network option to configure network. You can define network settings like ip, netmask, gateway etc.


------- Network ---------------------------------------------------------------

1- TCP/IP
2- DNS
3- Ping Utility
4- FTP Server
5- Telnet/SSH
6- Web/SSL/TLS
7- Email
8- SNMP
9- Syslog
10- ISX Protocol

- Back, - Refresh, - Event Log



8. Likewise you can configure your PDU as per your need.

Wednesday, August 26, 2009

How to setup rsync

If you want to run rsync as a daemon make sure following thing.
- rsync is not hashed in /etc/services

- I have created following script to start rsync daemon which uses /etc/rsyncd.conf file

######### Creating start/stop script ..... /etc/init.d/rc.d/rsyncd

#!/bin/sh
# Rsyncd This shell script takes care of starting and stopping the rsync daemon
# description: Rsync is an awesome replication tool.

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

[ -f /usr/bin/rsync ] || exit 0

case "$1" in
start)
action "Starting rsyncd: " /usr/bin/rsync --daemon
;;
stop)
action "Stopping rsyncd: " killall rsync
;;
*)
echo "Usage: rsyncd {start|stop}"
exit 1
esac
exit 0

##########

######### Create /etc/rsyncd.conf file

### Rsync Configurations ###
uid = nobody
gid = nobody
use chroot = no
max connections = 10
syslog facility = local5
pid file = /var/run/rsyncd.pid
motd file = /etc/rsyncd.motd
lock file = /var/run/rsync.lock

[daily_backup]
path = /backup/
auth users = backup
comment = Main backup directory.
#### secrets file = /etc/rsyncd.secrets


IMP NOTE:
We should take care of trailing "/" while specifying the source directory for data copying.
for example,

rsync -avz -e ssh remoteuser@remotehost:/remoterdir/data/for/copy/ /local/data/dir

Above example means that /local/data/dir must be available to to receive data from /remoterdir/data/for/copy/, otherwise rsync will simply download all the files into the path given as destination.

rsync -avz -e ssh remoteuser@remotehost:/remoterdir/data/for/copy /local/data/dir
in this case "copy" directory will be created first under /local/data/dir directory and data will be populated from remote host.


I have created script to copy data remotely.

#!/bin/bash
# Script to copy data on remote machine.

RSYNC=/usr/bin/rsync
RSSH=/usr/bin/ssh
RUSER=backup
RHOST=backup.remote.host.com
RDATABASE=/backup/Database
RDIR=/backup/Directory/

$RSYNC -avz -e $RSSH /backup/daily/ $RUSER@$RHOST:$RDATABASE/MySQL/
$RSYNC -avz -e $RSHH /var/www/html/ $RUSER@$RHOST:$RDIR


Please generate password less keys to copy data remotely without interruption. Use "ssh-keygen"

Monday, August 24, 2009

Postgresql backup and restore.

First method using pg_dump and second one is file system level backup.

Dump level Backup:
pg_dump dbname > outfile

Options available with pg_dump,
-h hostname. Default is localhost or whatever is set in PGHOST variable.
-p which port. PGPORT env.
-U username. default is logged in user name. PGUSER env.
outfile - name of the target file

Note:
pg_dump does not block other operations on the database while it is working. (Exceptions are those operations that need to operate with an exclusive lock, such as VACUUM FULL.)

Restore:
psql dbname < infile
infile - infile is what you used as outfile for the pg_dump command.

It is suggested to run analyze on each db to obtain the useful statistics. Run,
vacuumdb -a -z to VACUUM ANALYZE all databases;

pg_dump and psql can also use to dump a database directly from one server to another;
for example:
pg_dump -h host1 dbname | psql -h host2 dbname

2. File system level backup
tar -cf backup.tar /usr/local/pgsql/data
- Servers must be shutdown before taking backup.
- To restore database, we have to restore full database, can not do partial restore of tables or etc.

Wednesday, August 12, 2009

Open GUI application via ssh

ssh -p 2222 -l nilesh -X -v {remote.host.ip.or.hostname}

-p 2222 In case your server runs a non-standard TCP port.
(If yours runs on the default port (TCP port 22), there is no need to add this option.)

-l nilesh is only required if you do not have matching usernames on remote host.

-X allows X forwarding. Use -x can be used to disable X11 forwarding

-v is verbose. This lets you watch what is going on.

Run your application once it is done.
I was about to run virt-manager GUI application, which ran successfully :)

Virtualization: Xen Installation

How Xen works?
Xen hypervisor is run on top of the hardware which is the virtual machine monitor. Guest operating systems are run on top of this hypervisor, thus all guest operating systems are secondary to the hardware and contacts the hardware through the hypervisor. The first thing for grub would be to load the hypervisor. Look at the /boot/grub/grub.conf which loads the xen.gz-2.6.18-128.4.1.el5 which is the hypervisor.

Hypervisor loads the Dom-0 kernel and initrd image and starts the main system. Dom-0 itself is a guest operating system with additional privileges to manage other guest operating systems and is started with system start up.

Following rpms should be installed for Xen virtualization,
- kernel-xen ---> Dom-0 and Dom-U kernels.
- xen ----------> Xen hypervisor and other management tools.
- libvirt ------> Libraries required to manage domains which is used as a backend for virtmanager. http://libvirt.org
- virt-manager ----> GUI interface to manage guests

Once installation of above RPM's are done, System should be rebooted using the new XEN kernel.

Tuesday, August 11, 2009

Hidden ports on Linux.

A nice blog post about the hidden ports on linux.
http://www.ossec.net/dcid/?p=87

Thursday, July 30, 2009

**FATAL_ERROR** No password for admin user - please re-run ntop in non-daemon mode fir st

When you install ntop, daemon does not start automatically. It returns above error when you try to start it.

You need to set password to start ntop in daemon mode.
"ntop -A" or ntop --set-passwd

It asks for password, set it.
Then start the service.
/etc/init.d/ntop start

You are now ready to view your network statitics :).

checking for intltool >= 0.35.0... ./configure: line 16914: intltool-update: command not found

Error:
checking for intltool >= 0.35.0... ./configure: line 16914: intltool-update: command not found
configure: error: Your intltool is too old. You need intltool 0.35.0 or later.

Solution:
1. Install package, intltool-0.35.0-2.i386
2. It will fail for following dependency if XML Parser not installed.
error: Failed dependencies:
perl-XML-Parser is needed by intltool-0.35.0-2.i386
3. Also Download and install perl-XML-Parser package

Error! You need to have libevent 1.4.X or better.

You need to install libevent-devel package. Please find the respective package for your OS and install it. Also check whether you have already install libevent.

Wednesday, July 29, 2009

How to monitor bandwidht using MRTG and Nagios

Assuming that you have enough knowledge of Unix system and Nagios monitoring. If you dont know how to configure nagios please follow this link

Prerequisite:
- Make sure Nagios is running properly. Check http://localhost/nagios
- Also make sure that you have installed nagios_plugins.
- Iptables and Selinux must be disabled.

Install check_snmp plugin:
- Make sure you have all following packages install for successful installation of snmp plugin.
net-snmp, net-snmp-devel, net-snmp-libs, net-snmp-utils, beecrypt-devel,
elfutils-devel, elfutils-devel-static, lm_sensors

- To install check_snmp I download the plugin from this location. check_snmp

1. Unzip the downloaded file
bunzip check_snmp-1.1.tar.bz2

2. Untar it.
tar xvf check_snmp-1.1.tar

3. Configure and install it.
./configure
make
make install

4. Once it is install successfully you can find check_snmp at /usr/local/bin location.

5. Create a soft link for check_snmp.
ln -s /usr/local/bin/check_snmp /usr/local/nagios/libexec/check_snmp


Install MRTG:
To monitor bandwidth usages of router/switch you must have mrtg installed on system. Before installation please make sure you have install gd, libpng, zlib packages.

1. Download MRTG.

2. Once all libraries installed required for MRTG you are all set to compile and configure MRTG.
gunzip -c mrtg-2.16.2.tar.gz | tar xvf -
cd mrtg-2.16.2

3. ./configure --prefix=/usr/local/mrtg-2
make
make install

4. Create /var/www/html/mrtg file to store mrtg html files.
mkdir /var/www/html/mrtg

5. Now you need not to create mrtg configuration file. Use cfgmaker.
cfgmaker --global 'WorkDir: /var/www/html/mrtg' --global 'Options[_]: bits,growright' --output /etc/httpd/conf/mrtg.cfg public@172.17.42.22
( I choose default apache web location for installation of mrtg html files and apache conf directory to store mrtg.cfg.)

6. Go to respective location and make sure that above command has created respective files.
cd /var/www/html/mrtg;
ls -al /etc/httpd/conf/mrtg.cfg

7. Run this command to update mrtg log file.
env LANG=C /usr/local/mrtg-2/bin/mrtg /home/mrtg/cfg/mrtg.cfg

8. create a script to update the mrtg log file which will fetch data regularly and display in graph as well as on nagios.
vi /usr/local/mrtg-2/bin/monitor_mrtg.sh

9. Put following lines in it and save.
#!/bin/sh
env LANG=C /usr/local/mrtg-2/bin/mrtg /home/mrtg/cfg/mrtg.cfg
(When you run it first time it returns you few errors/warnings. Ignore it.)

chmod 755 mrtgbw.sh ; Make script executable.

10. Set cron to run above script every 5 minute.
crontab -e

11. Modify and save,
*/5 * * * * /usr/local/mrtg-2/bin/monitor_mrtg.sh

12. Restart cron service.
/etc/init.d/crond restart

13. Confirm that it is been configured.
http://localhost/mrtg/{name of html file}

Actually when you run mrtg command it searches for respective router community collects all data from router. Accordingly it creates log file. Like in my case it has found port 2 running on router and hence created file 172.17.42.22_2.log, 172.17.42.22_2.html. So I can access my graph through this link,
http://localhost/mrtg/172.17.42.22_2.html

Procedure to monitor Bandwidth Usages in Nagios:
1. Default installation directory of nagios is /usr/local/nagios/.

2. Open switch.cfg file
vi /usr/local/nagios/etc/objects/switch.cfg

3. Make changes according to your router specifications. Like,
define host{
use generic-switch
host_name Router_1
alias Router 1
address 172.17.42.22
hostgroups switches
}
4. You can also set PING, Uptime, Ports Link Status etc.
define service{
use generic-service ; Inherit values from a template
host_name Router_1 ; The name of the host the service is associated with
service_description PING ; The service description
check_command check_ping!200.0,20%!600.0,60% ; The command used to monitor the service
normal_check_interval 5 ; Check the service every 5 minutes under normal conditions
retry_check_interval 1 ; Re-check the service every minute until its final/hard state is determined
}

define service{
use generic-service ; Inherit values from a template
host_name Router_1
service_description Uptime
check_command check_snmp!-C public -o sysUpTime.0 -H 172.17.42.22
}

define service{
use generic-service ; Inherit values from a template
host_name Router_1
service_description Port 2 Link Status
check_command check_snmp!-C public -o ifOperStatus.2 -r 1 -H 172.17.42.22
}

define service{
use generic-service ; Inherit values from a template
host_name Router_1
service_description Port 2 Bandwidth Usage
check_command check_local_mrtgtraf!/var/www/html/mrtg/172.17.42.22_2.log!AVG!1000000,1000000!5000000,5000000
!10
}

5. Verify the configuration of nagios
/usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg

6. Restart nagios service.
/etc/init.d/nagios restart

Tuesday, July 21, 2009

Solaris: Disk Management

- A disk under the Solaris OE can be divided into eight slices that are labeled Slice 0 through Slice 7.
- In reality Slice 2 represents the entire disk because "/" is the first(0) slice and swap is second(1).

Dist Slice Naming Convention, Controller number, Target number, Disk number, Slice number.
- Controller number, which control communications between system and disk unit.
- Target number is a unique hardware address of disk, tape, CDROM etc.
- Disk number is a logical unit number.
- Slice number is partition number on disk.