Quick HOWTO : NFS (Network File system) Setup in Linux

Friends, Here is the Quick HOWTO again.. Hope this post is useful for quick reference

Points to Note:
 1. NFS is transparent access to remote file systems
 2. It is Installed by default
 3. Uses RPC for communications

 1. Export a directory on the server using: /etc/exports

Entry something like this,
  a. /path_to_directory     IP_ADDR(rw)  

[example :  /nfs1 ]
  c. mkdir /nfs1
  d. start NFS server - 'service nfs start'
  e. Confirm export(s) - 'exportfs -v'

Note: NFS matches remote user's UID to local /etc/passwd to determine ACLs

Now login to remote machine and do following.

 3. Mount exports on a remote system

 [ Example:  mount -t nfs /nfs2 ]

 4. Allow local 'root' user the ability to write to /nfs1 export
  a. /etc/exports: (rw,no_root_squash)

 5. Setup mount points so that they're available upon reboot in /etc/fstab

Unmount and confirm that NFS mount points will be available when the client system changes runlevels (reboots, starts, etc.) - 'mount -a'

showmount -a - shows mounts on this system (connected NFS clients)

 6. Attempt to mount /nfs1 from an unauthorized system

  • Fails because client's IP does not match server's /etc/exports
  • Update server's /etc/exports to allow additional hosts/subnet/etc.
  • exportfs -a - to update the export table

Quick HOWTO : Kernel Upgrade in Linux

Here is the Quick HOWTO Steps to upgrade the Kernel in Linux..

 1. Update the kernel
  a. use 'uname -a' to reveal current version
  b. use 'rpm -qa | grep -i kernel' - to reveal installed version
  c. cat /etc/grub.conf -> /boot/grub/grub.conf - "" ""

 2. Proper installation method is as follows:
  a. 'rpm -ivh kernel*rpm' - install a separate version

Note: Install the following kernel packages if necessary:
  a. kernel-devel* - if module compilation is necessary
  b. kernel-headers* - if recompilation is necessary

  a. rpm -ivh kernel-2.6.18-53.el5.i686.rpm 
Note: This will update GRUB (/boot/grub/grub.conf)
Note: Will also place the new kernel in the /boot file system

Examine traces in:
 a. /boot
 b. /boot/grub/grub.conf

3. Remove traces of former kernel using 'rpm -e [--nodeps]'
 a. kernel-2.6.18-8.el5 - removes older version
 b. kernel-headers-2.6.18-8.el5 - force remove ignoring dependencies 'rpm -e --nodeps kernel-headers-2.6.18-8.el5'
 c. kernel-devel-2.6.18-8.el5

4. Install new 'kernel-headers' and 'kernel-devel' packages using YUM:
 a. yum -y install kernel-headers
 b. yum -y install kernel-devel

5. Confirm that the 3 'kernel-*' packages are installed:
 a. rpm -qa | grep kernel

Note: Removal of older kernel-* packages cleans up:
 a. /boot
 b. /boot/grub/grub.conf (menu.lst)

Quick HOWTO : Crontab Quick Reference

Here is the quick reference for Crontab. Cron is the easy way to run the programs/tasks at scheduled time.. Hope this quick reference for Linux admins..

  1. Scheduler
  2. Rules (Cron entries) are based on times:
   a. minute (0-59)
   b. hour (0-23)
   c. day of the month (1-31)
   d. month (1-12)
   e. day of the week (Sun,Mon,Tue, etc. OR 0-7)
   f. command to execute (shell, perl, php, etc.)
 3. Wakes up every minute in search of programs to execute
 4. Reads cron entries from multiple files
 5. Maintains per-user and system-wide (/etc/crontab) schedules

cron.deny - denies cron execution by user
cron.monthly/ - runs jobs monthly
cron.weekly/ - runs jobs weekly 
cron.daily/ - runs jobs daily
cron.hourly/ - runs jobs hourly
crontab - contains system-wide schedules

Note: '*' wildcard in a time column means to run for all values

Per-user Crontabs:
Stored in: /var/spool/cron

Note: 'crontab -l' - enumerates per-user cron entries

System-wide Crontab:
Stored in: /etc/crontab

Note: 'crontab -l -u username' - enumerates per-user cron entries

Quick HOWTO : Redhat Package Management (RPM)

Folks, Here is Quick Reference and HOWTO for RPM (Redhat Package Management). Hope it will be useful..

  1. Provides package management
   a. Query
   b. Install
   c. Uninstall
   d. Upgrade
   e. Verify
  2. Auto-verifies packages using GPG, MD5, SHA1SUMs
  3. Automatically reports on unresolved dependencies

Install (Does NOT overwrite previous package):
Note: Use this method to install a new version of the kernel
  1. rpm -ivh *.rpm
  2. rpm -ivh

Upgrade (Installs or overwrites existing package):
  1. rpm -Uvh *.rpm
  2. rpm -Uvh

Freshen (Updates an existing package):
Note: Will NOT install the package, if it doesn't exist locally

  1. rpm -Fvh *.rpm - freshens the current version of a package

 1. rpm -ev *.rpm - removes a pacakge
Note: removal process considers dependencies and will complain if the removal will break 1 or more packages. To get around this, use '--nodeps' option with 'rpm -ev --nodeps *.rpm'

 2. rpm -ev gftp


  1. rpm -qa - shows all installed packages
  2. rpm -qa | wc -l - this dumps all packages and provides a count
  3. rpm -qa | grep -i sendmail
  4. rpm -qi nano - dumps info. about the 'sendmail' package as it's recorded in the local RPM database
  5. rpm -qf /usr/bin/nano - dumps package membership info. for the 'nano' file
  6. rpm -qpi - dumps info. about the uninstalled 'dhcp' package, which resides on the repository
  7. rpm -ql package_name - returns all included files

  1. rpm -Va - verifies ALL packages on the system, returning info. only if there are discrepancies from the original installation

  2. rpm -Vf /usr/bin/nano

Task: Change '/usr/bin/nano' then verify

SM5....T   /usr/bin/nano

S(file size), M(mode or permissions), 5(MD5), T(mod time)
  3. rpm -Vp nano

Quick HOWTO: Resize Logical Volume (LV) in Linux

Here is the quick steps to Resize Logical Volume in Linux..

If you want grow (resize) 'logvolopt1' to 20GB

 1. lvresize -L 20GB /dev/volgroup001/logvolopt1
 2. lvdisplay - to confirm new size of logical volume
 3. df -h - will still reveal the current size
 4. Resize the file system to update the INODE table on the logical volume to account for the new storage in 'logvolopt1'
  'resize2fs -f -p /dev/volgroup001/logvolopt1'

Note: You may resize file systems online if the following are met:

  a. 2.6x kernel series
  b. MUST be formatted with ext3

If you want to shrink (resize) 'logvolopt1' to 15GB

 1. lvresize -L 15GB /dev/volgroup001/logvolopt1
 2. lvdisplay
 3. df -h
 4. resize2fs -f -p /dev/volgroup001/logvolopt1

 Note: online shrinking is not supported

 5. df -h

Note: Check disk utilization prior to shrinking to reduce the risk of losing data.. 

Hope these Quick HOWTO will help administrators for quick reference.
cheers :-)

Quick HOWTO : Extend a filesystem in AIX command line

Suppose you want to extend /usr file system to 4GB

chfs -a size=4G /usr
chfs -a size=4000M /usr

or you want to add some more space like 2GB with existing size
chfs -a size=+2G /usr 

You can extend the root file system same way. Suppose the new size you want is 2GB, then

chfs -a size=2G / 
chfs -a size=2000M /

Hope this will be helpful :)

Quick HOWTO : Samba Implementation with Active directory authentication in Linux


1. Administrator don’t need to create/maintain separate accounts for samba shares
2. Users don’t need to remember separate password for samba
3. Users can change their samba password without system administrator’s help
4. Users home drive can be mapped via login script while they are logging into their PC/Laptops/Citrix


We are going to use, Kerberos Authentication method here. There are two files to edit to achieve this,

a. /etc/samba/smb.conf
b. /etc/krb5.conf

Do the modifications to /etc/samba/smb.conf as follows,

#========== Global Settings ========


log file = /var/log/samba/%m.log
dns proxy = no
server string = Samba Server
password server = (domain controller name)
path = /var/spool/cups
workgroup = (Netbios name of domain)
security = ADS
max log size = 50
pam password change = yes

wins server = (wins server name)

#======= Share Definitions =========

comment = Home Directories
browseable = no
writable = yes

comment = All Printers
guest ok = yes
writeable = no
printable = yes
public = yes
use client driver = yes
path = /var/spool/samba

Do the Modifications to /etc/krb5.conf as follows,


default = FILE:/var/log/krb5libs.log
kdc = FILE:/var/log/krb5kdc.log
admin_server = FILE:/var/log/kadmind.log

ticket_lifetime = 24000
default_realm = (DOMAIN NAME IN CAPS)
dns_lookup_realm = false
dns_lookup_kdc = false


kdc = (domain controller server):88
admin_server = (domain controller server):749
default_domain = (domain name)

.(domain name) = (DOMAIN NAME IN CAPS)
.(domain name) = (DOMAIN NAME IN CAPS)


profile = /var/kerberos/krb5kdc/kdc.conf

pam = {
debug = false
ticket_lifetime = 36000
renew_lifetime = 36000
forwardable = true
krb4_convert = false

Type the following command in terminal,

service winbind start

kinit administrator@DOMAINNAME

net ads join -U administrator 

You will be asked to enter the AD Administrator password. When the command line doesn't return a value, you're now connected to the Active Directory. Now you are done with the setup. :)

Quick HOWTO : Simple steps to Kickstart a Linux Server with CD/DVD

1.  Copy the /root/anaconda-ks.cfg as a base from your customized installation of Linux
2.  Setup a web-server with the loopback dvd mounted and reachable
3.  Make sure the kickstart file is reachable through the web-server
4.  Boot the client to be kickstarted with options

Options are:

linux ks=http://<your webserver>/<your ks-file>

linux ks=

Thats all... Done :)

Quick HOWTO : Removing/Installing Tape drive in AIX

To remove Tape drive in AIX

rmdev -dl rmt0  or smirrty rmdev

if u r not keeping the definition, while u removing, you need to poweroff the tape drive and on again to redetect

To detect again,

cfgmgr -v
cfgmgr -l <devicename> -v

Tape drive will be automatically detected and available for use.

Tips : Some useful notes for Linux

File / Command
Startup script
Kernel Parameters
sysctl -a
Reconfigure the kernel
cd /usr/src/linux 
make mrproper  
make menuconfig  
make dep  
make clean  
make bzImage 
make install 
make modules 
make modules_install
cp arch/i386/boot/bzImage /boot/vmlinuz-2.2.16 
mkinitrd /boot/initrd-2.2.16.img 2.2.16 
vi /etc/lilo.conf 
List modules
Load module
Unload module
Initialize system
Physical RAM
free -m
Kernel Bits
getconf LONG_BIT
Crash utility
Trace System Calls
Machine model
uname -m
OS Level
uname -r
Run Level
Hardware Information
Timezone Management
NTP Daemon

Quick HOWTO : Simple steps to Install YUM Update Server in Linux

There are several ways. I provided one of the simple way with simple steps.. Follow the steps mentioned below.

1.Copy all data to /var/ftp/pub/Server
2. Install the createrepo rpm (If its not inistalled)
3. cd /etc/yum.repos.d/
4. vi parthi.repo

baseurl=file:///var/ftp/pub/Server (Use ftp URL to setup this in client side)

(there should not be any other *.repo file exists..remove or rename the other repositories)

5. createrepo -v /var/ftp/pub/Server
6. yum clean all
7. yum update
8. You are done… Start using yum, it should work :)

Quick HOWTO : Connecting an iSCSI storage to a Linux Server

To connect a Linux Server to an iSCSI storage, Follow the steps

1. Install “iscsi-initiator” RPM Package in the linux server
2. Usually iscsi unique id located in the /etc/iscsi/iscsid.conf. provide this to your storage admin to assign the
3. Use the command “iscsiadm -m discovery -t sendtargets -p <iSCSI storage IP>”
4. Then do “service iscsi restart”
5. Now give “fdisk –l”. Now you can able to see the new disk detected in the linux server.
6. create a file system on the disk and mount the same

You are done :)

Scripts : Shell script to send mail using telnet in Linux

while [ $count = 1 ]
( echo open MAIL-SERVER-NAME 25
sleep 8
echo mail from: SENDER-ADDRESS
sleep 2
sleep 2
echo data
sleep 2
echo subject:  YOUR-SUBJECT-HERE
echo this is a test mail
sleep 5
echo .
sleep 5
echo quit ) | telnet