Difference Server Type Hardware Configuration Data Center

RACK Server:
1) Rack server is typically measured by U’s scale in vertically.
Like 1U, 2U, 3U.
BLADE Server:
Blade server an additional level innovation of RACK Server.
It has two parts.
a) Blade carrier
b) Blade Server
Blade server typically placed inside the Blade Carrier by together they form blade system.

Advantages
Hot Plugging like, Network ports, Power Connection, Switches are modular design.
There is no need to plug manually. Just we have to insert the blade server into blade carrier.

How To Configure RSH – Remote Shell

1) Enable rsh
#vim /etc/xinetd.d/rsh
Replace
disable=yes into disable=no
wait = yes into wait=no
2) Enable rexec
#vim /etc/xinetd.d/rexec
Replace
disable=yes into disable=no
wait=yes into disable=no
3)Enable rlogin
#vim /etc/xinetd.d/rlogin
disable=yes into disable=no
wait=yes into wait=no
4) Enable securetty
Add rsh,rlogin.rexec into the /etc/securetty
/etc/securetty
Enable the service for login with tty devices.
5) PAM - Pluggable Authentication Module.
Purpose
1) Authentication condition.
2) Define the Session Module.
#vim /etc/pam.d/rsh
Replace
auth required pam_rhosts.so into
auth sufficient pam_rhosts.so

6) Add the trusted Host List
#vim /root/.rhosts
List of hosts Login without password or server admin granted "TRUSTED"
rsh/rlogin Remote access without supplying Password.

Finally trying from the Client Machine, using rsh,rlogin,to verify rsh- Remote shell.

Compare Time stamp In Shell Script year, Month day, Hour, Minute, Second

Linux How To Compare the timestamp
1) Using Date command we can compare
2) In these format i used just simple numberical comparsion and it'wll work for timestamp comparsion.
Year-Month-day-Hour-Minute-second.
3)syntax
Date1=`date +%Y%m%d%H%m%S`;
Date2=`date +%Y%m%d%H%m%S`;
if(Date1 Condition Date2)
date +
%y - Year in Two Digit
%Y - year in Four Digit
%m - month in Numberic
%d - Date
%H- Hours
%h - Month in String

For Example
current_time=`date +%Y%m%d%H%M%S`;
Year-Month-Date-Hour- Minute-Second
if [ "$login_time" -lt "$current_time" ]; then
How To Compare  Time stamp in Shell Script.

How To Create initrd Image Temporary File System initrd

1)initrd is a image file.
2)initialize Ram Disk Image.
3)initrd is temporary file system used in the boot Process of the Linux Kernel.
4)initrd contain basic executable files utilities and Essential Drivers, that leads kernel to mount root File system.
5)In these temporary file system it contain directory, bin,etc,init,dev,lib,loopfs,proc,sys,sysroot File is init.
6)This initrd image Contain the Same version & Number of kernel
Example
initrd Image initrd-2.6.9-5.EL.img
kernel vmlinuz-2.6.9-5.EL


How To Extract Initrd File.
#gunzip < /boot/initrd.img | cpio -i
cpio -i It will Extract the Image.
-o Create the Image
-v Verbose.
1) Copying files from Archive
2) Extracting Files from Archive
#ls /etc/*.conf | cpio -o --forma=tar > conf.tar

Difference Between Incremental Backup Differential Backup Rotational Backup

Incremental Backup: Backup of files that's are NEW or CHANGED Since Last Backup.
Backup Time: It will take the least time.

Differential Backup: Backup of the files, which are NEW or CHANGED Since LAST FULL Backup.
Backup Time : It will take more time compare to Incremental Backup.

Comparison : Incremental Vs Differential
Differential Backup it is middle stage between Full Backup & Differential Backup.
Main Difference is Incremental take backup from Last Backup. Differential take backup from LAST FULL Backup,

FULL BACKUP: Complete Backup of everything.
Backup Time: It will take more time rather than DIFFERENTIAL BAKUP.

Compile Kernel Install Remove Kernel Driver Module

Purpose- Reason For Kernel Compilation
Advantages
1) It is easy to Add New Features.
2) For new Hardware if it does not have proper
kernel Module, then we can rebuilt the kernel through Kernel compilation.

How To Compile Linux Kernel Source code.
1) Go to the Linux Kernel Directory/usr/src/kernels/2.6.9-5.EL-i686
Type #make menuconfig
2) Configure & compile the Kernel Source Code
For Example To Add Driver  for Key board Choose the Following Sub Menu from the #make menuconfig.
-make menuconfig - Device Drivers - Input Device Support - Keyboard - Choose the Keyboard,
3)#make menuconfig. It will build their Kernel Driver Modules Under /lib/module/`uname –r`

Linux Kernel Important Directories
1)/lib/modules/`uname -r` - Kernel Driver Modules
/lib/modules/2.6.9-5.EL/kernel/drivers/ - Contain the Linux Kernel Driver.
2) /usr/src/kernels/2.6.18-128.el5/ Contain the Linux Kernel Source.
3)/usr/include/linux - It contain the List of Header Files
/lib/modules/2.6.9-5.EL/kernel/drivers/net/ - Network Driver Modules
/lib/modules/2.6.9-5.EL/kernel/drivers/input – Keyboard, Mouse Driver Modules

How To Find Module Dependencies List Modules
lsmod  List Modules Get the Information From the /proc/modules.
depmod list the dependencies module.
depmod -v List Which module is depend on the other module.
For Example: via-velocity.ko it is Network Module located Under /lib/modules/version/kernel/drivers/net/filename.ko
/lib/modules/2.6.9-5.EL/kernel/drivers/net/via-velocity.ko needs "crc_ccitt": /lib/modules/2.6.9-5.EL/kernel/lib/crc-ccitt.ko
.ko it is kernel Modules

How To Install Or Remove The Module Loading / Unloading Module
modprobe - Install/remove the Module
insmod - Insert The Module
rmmod - Remove The Module
Compression Between modprobe And insmod/rmmod
1) For modprobe there is no need to mention any path. It is automatically install the module. But Insmod , rmmod we have to mention the Path.
Example:
#insmod kernel/drivers/net/wireless/airo.ko
2) Using Single Command we will Install & Remove Module for modprobe. We had separate command like insmod , rmmod.

/usr/bin/ld Cannot Find Library Path Linkage Problem

STUDY : Open Source Application MakeFile Important Environment Variable.
CFLAGS     - C Compiler Flags.
LDFLAGS  - Library Path
CC C          - Compiler Command.
-L - User Define Library path Example -L /usr/X11R6/lib/.
-l  - Search from Common Library Path(/lib) -lX11.
#gcc -L /folder/contain/library/path/event/ -levent.

When I try to install Open Source Application I got the Following ERROR MESSAGE:
/usr/bin/ld: cannot find -lX11
collect2: ld returned 1 exit status
make: *** [eterm] Error 1

REASON : This type of issue Happened when it does not find the Proper Libraries in the Default Path(lib)  or (-L) Specified Location.


FULL ERROR MESSAGE : cc -o eterm main.o init.o close.o font.o gc.o api.o sink.o select.o serial.o print.o tot_compose.o -O2 -Wall -fomit-frame-pointer -march=i386 -s -L /usr/X11/lib libansi.a libvt.a libsie.a libtel.a libwy.a -lX11 -L ../../OPT/MLT-Display-Lib/ -liscdisp -lstdc++ -L ../../opt/getval -lgetval
/usr/bin/ld: cannot find -lX11
collect2: ld returned 1 exit status
make: *** [eterm] Error 1

SOLUTION:
1) We have to install the Proper Library Package.
2) Or if it is already installed, we need to Link the Correct Library Path with -L and -l Option.
....-march=i386 -s -L /usr/X11/lib .... libtel.a libwy.a -lX11
From the Above Statement it tries to find the Library X11 from /usr/X11/lib.
 But it can't find, Because  X11 Located in /usr/X11R6/lib/.
So we have to replace from /usr/X11/lib to /usr/X11R6/lib. Change this Variable (LDFLAGS) in Makefile.

How To Find Out,Whether Library Package Is Already Install Or Not.
METHOD 1
#gcc program.c -lgetval
1)-lgetval is Library.
2) It is located under Default Library Path /lib
3) To find #locate getval | grep lib
File is located under /lib/libgetval.so
METHOD 2
#gcc graphics.h -L /usr/X11/lib –lX11
1) We have to Search Xll library path under /usr/X11/lib
2) #find /usr/X11/lib –name X11*
3) If it is not located, we have to search whether is it located in any another Path. Like
4)#find / -name X11*
5)if it is locate then change –L Correct Directory Path or
 6)if it can't find anywhere else, Then we have to install particular library.

Similar Error Message:
/usr/bin/ld: cannot find -lz
 
/usr/bin/ld: cannot find -lc
 
/usr/bin/ld: cannot find -lgcc_s_32

/usr/bin/ld: cannot find -lXaw
 
/usr/bin/ld: cannot find -lImlib2
 
/usr/bin/ld: cannot find -lperl

Sed Command Search Replace Delete Add Line Tricks and Tips

sed -e "expression script"
-i to edit in place" Edit and save"

Sed How to Replace slash / And backslash \ character
Slash / represent as Normal /
backslash \ represent as \\
Example:
# cat sedlinux.txt
hi/kumar\kumar/
a)sed 's:\\:/:g' sedlinux.txt [ change back slash \ into slash / ]
hi/kumar/kumar/
b)sed 's:/:\\:g' sedlinux.txt [ change slash / into back slash \ ]
hi\kumar\kumar\

#sed 's:/var/www/html:/home/username:g' filename
|Replace /var/www/html to /home/username
#sed -n '1~3p' filename | Print Every 3rd Line 1st,1+3 4th,7th line.
#sed -n '0~2p' filename | Print Every 2nd LIne 0st,2nd,4th,6th,

#sed '3i New Line' filename.txt | It will add New Line On 3rd Line.
#sed -n '0~2i word' file | Add the new line in 0,2,4,6 th Line.

To delete the line with matching Character
#sed -i '/matchword/d' phone.txt
#sed -i '/^$/d' phone.txt  - ^$ it will delete the empty lines
#sed '0~2d' filename -  d Delete Line - 0,2,4,6

Replace every second occurrence in the line.
#sed ‘s/Search_Word/Replace_Word/2’ filename
Sed Replace with variable
#sed “s/$Search_Variable/$Replace_Variable/g” filename

Recover Deleted Log Files without Third Part Software Linux.

CONDITION:
1)without rebooting server.
2)we can get Only the Log files in this method.

LOG FILES are Generated In Two ways
1)syslog Daemon.
Example : -maillog,cron,var-log-message,
2)Using File Descriptor Without syslog Daemon
Example : http,
Note : Using File Descriptor (Input,Output,Error redirection) Generate Log Files.

STUDY:
#cat /proc/"Process ID"/fd List out the file descriptor file which are used by these specific Process ID.

Using syslog Daemon Recovering Log Files
1)Find the Process Id Of the syslog Daemon
#ps -ef | grep syslog
2)List out the Specific Process ID File Descriptor Files.
#ll /proc/"PID of syslog"/fd/
For Example if PID is 1947 then,
# ll /proc/1947/fd/
lrwx------ 1 root root 64 Nov 4 12:38 0 -> socket:[4341]
l-wx------ 1 root root 64 Nov 4 12:38 1 -> /var/log/messages
l-wx------ 1 root root 64 Nov 4 12:38 2 -> /var/log/secure
l-wx------ 1 root root 64 Nov 4 12:38 3 -> /var/log/maillog
l-wx------ 1 root root 64 Nov 4 12:38 4 -> /var/log/cron
l-wx------ 1 root root 64 Nov 4 12:38 5 -> /var/log/spooler
l-wx------ 1 root root 64 Nov 4 12:38 6 -> /var/log/boot.log
l-wx------ 1 root root 64 Nov 4 12:38 7 -> /var/log/news/news.crit
l-wx------ 1 root root 64 Nov 4 12:38 8 -> /var/log/news/news.err
l-wx------ 1 root root 64 Nov 4 12:38 9 -> /var/log/news/news.notice
3)Even Though we deleted that file, it has some soft link access. Using these features.
we can recover these file.
For example : if we want to recover /var/log/cron file. then
l-wx------ 1 root root 64 Nov 4 12:38 4 -> /var/log/cron
#cp -var 4 /tmp/cron.backup

Recover Log file for Specific Service Which are Not maintain by syslog Daemon
1) This is also the same Method. But find out the Particular service Process Id rather than syslog Daemon PID. For Example http Service.
#ps -ef | grep http
# lsof -p "PID of http" | grep log
2) Remaining Same as the Above Method.
#ls /proc/"PID of http"/fd