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

By Parthiban Ponnusamy

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


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


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


[example :  /nfs1          192.168.75.110(rw) ]
               
  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
  a. mount -t nfs REMOTE MACHINE IP:SHARE_NAME   LOCAL_MOUNT_POINT


 [ Example:  mount -t nfs 192.168.75.199:/nfs2 /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 192.168.75.199 - 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

By Parthiban Ponnusamy

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


 Steps:
 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


Install:
  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

By Parthiban Ponnusamy

Folks, 
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..


Features:
  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

/etc:
cron.d/      
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)

By Parthiban Ponnusamy

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


 Features:
  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 http://192.168.75.100/RH5/i386/Server/dhcp-3.0.5-7.el5.i386.rpm



Upgrade (Installs or overwrites existing package):
  1. rpm -Uvh *.rpm
  2. rpm -Uvh http://192.168.75.100/RH5/i386/Server/dhcp-3.0.5-7.el5.i386.rpm

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


Removal:
 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


Query:


  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 http://192.168.75.100/RH5/i386/Server/dhcp-3.0.5-7.el5.i386.rpm - dumps info. about the uninstalled 'dhcp' package, which resides on the repository
  7. rpm -ql package_name - returns all included files


Verify:
  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

By Parthiban Ponnusamy

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 : Lock and unlock a user in AIX

By Parthiban Ponnusamy

To unlock,

chuser account_locked=false user
or
chsec -f /etc/security/user -a account_locked=false -s user

To lock,

chuser account_locked=true user
or
chsec -f /etc/security/user -a account_locked=true -s user

Video Tutorial : Configuring Linux IP tables

By Parthiban Ponnusamy


Linux IP TABLES Configuration... Simple HOWTO..

Hope it will be helpful..

Quick HOWTO : Extend a filesystem in AIX command line

By Parthiban Ponnusamy

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


chfs -a size=4G /usr
or
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 / 
or
chfs -a size=2000M /


Hope this will be helpful :)


Quick HOWTO : Samba Implementation with Active directory authentication in Linux

By Parthiban Ponnusamy

Advantages:



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



Implementation:



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 ========


[global]


log file = /var/log/samba/%m.log
realm = (DOMAIN NAME IN CAPS)
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 =========


[homes]
comment = Home Directories
browseable = no
writable = yes




[printers]
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,


[logging]


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

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




[realms]


(DOMAIN NAME IN CAPS) = {
kdc = (domain controller server):88
admin_server = (domain controller server):749
default_domain = (domain name)
}

[domain_realm]
.(domain name) = (DOMAIN NAME IN CAPS)
.(domain name) = (DOMAIN NAME IN CAPS)



[kdc]


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

[appdefaults]
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

By Parthiban Ponnusamy

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>

Example:
linux ks=http://192.168.1.1/linuxkickstartfile.ks.

Thats all... Done :)

Quick HOWTO : Removing/Installing Tape drive in AIX

By Parthiban Ponnusamy

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
or
cfgmgr -l <devicename> -v


Tape drive will be automatically detected and available for use.

Tips : Some useful notes for Linux

By Parthiban Ponnusamy

Task
File / Command
Startup script
/etc/rc.d/rc
Kernel
/boot/vmlinuz
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 
lilo
List modules
lsmod
Load module
insmod
Unload module
rmmod
Initialize system
netconf
Physical RAM
free -m
Kernel Bits
getconf LONG_BIT
Crash utility
lcrash
Trace System Calls
strace
Machine model
uname -m
OS Level
uname -r
Run Level
runlevel
Hardware Information
dmidecode
Timezone Management
/etc/sysconfig/clock
NTP Daemon
/etc/ntp.conf
/etc/rc.d/init.d/xntpd

Video Tutorial : How To Install Red Hat Enterprise Linux via VNC

By Parthiban Ponnusamy

This tutorial is really useful... Installing Linux through VNC !


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

By Parthiban Ponnusamy

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

[parthi]
name=repository
baseurl=file:///var/ftp/pub/Server (Use ftp URL to setup this in client side)
enabled=1
keepcache=0



(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

By Parthiban Ponnusamy

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
    LUN
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 :)

Tips : Find Command helper..

By Parthiban Ponnusamy

Using this site, you can get the complete find command and its parameters easily.. Hope it will be very useful in day to day Unix activities. The Link is below..


Tips : Command to unlock an user account in HP-UX

By Parthiban Ponnusamy

To Unlock an User Account,

/usr/lbin/modprpw -k USERNAME

Hope this will be helpful for someone.

Scripts : Shell script to send mail using telnet in Linux

By Parthiban Ponnusamy

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