Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 73

REDHAT ENTERPRICE LINUX

RHEL Kernel Versions:

Rhel4 – 2.6.9 , Rhel 5 – 2.6.18 , Rhel 6 - 2.6.32 ...

Boot Process:

6 Stages of Linux Boot Process

POST => POWER ON SELF TEST – checks necessary hardwares

BIOS = > initialize I/O devices and identifies the BOOT device

MBR => Master boot Record 512 B (446 – Boot loader/GRUB , 66 – File system Table)

GRUB => Grand Unified Boot Loader (LILO -old kernel version doest support multi OS, grub supports)

Grub Loaded in Memory by MBR & it can read ext3 directly where as lilo doest

2 stages

(I)Loads the Second state of kernel

(II).Loads bootloader –show the splash screen and executes kernel and initrd images.

/boot/grub/grub.conf (/etc/grub/grub.conf – link file)

default=0
timeout=5
splash image=(hd0,0)/boot/grub/splash.xpm.gz
hiddenmenu
title CentOS (2.6.18-194.el5PAE)
root (hd0,0)
kernel /boot/vmlinuz-2.6.18-194.el5PAE ro root=LABEL=/
initrd /boot/initrd-2.6.18-194.el5PAE.img

GRUB just loads and executes Kernel and initrd images.

KERNEL :

Mount the root filesystem and executes /sbin/init program (1st program started by kernel)

Kernel uses initial ramdisk Initrd as temp root file system until kernel loaded in original root system.

 Uname –r -> to show the kernel versions


 Sysctl to change the kernel parameters
 Sysctl –p update the kernel form the file specified
 Sysctl –w to change
 Sysctl –a list all the values
 /etc/sysctl.conf
 /proc/sys/kernel

INITRD:

It’s a temp root file system. mounted during system boot to support the two stages of boot process, Its
consists of directories and executables which allows the real root file system to be mounted.(insmod- tool to
install kernel modules)

Location: /boot/initrd.img.versions

To create a new initrd image :

#mkinitrd –o /boot/initrd.$(uname-r).img $(uname-r) / $(uname-r) –gives the kernel versions.

INITTAB:

Reads /etc/inittab file

Identifies the default runlevel and executes the scripts in /etc/rc.d/rcx.d

Note: if default run level is not mention in rhe5 it will ask for EnterRunlevel , in rhel6 it will start init 3

Inittab format - id :runlevel:command : action


Runlevels

0-Halt / Shutdown

1 – single user mode

2-multi user mode without network

3 -multiuser mode with network

4 – unused

5 – graphical

6 – reboot

Note : scripts in /etc/rc.d/rc0.d has S – start ,K –kill ,and Sequence no for order of execution

After the execution of scripts we get the User login screen .It will contains the terminal details also tty etc

Commands :

Runlevel : displays the current runlevel


Init 1 2 3 5 6 to start particular run level

FSTAB:

Files which contains the mount points which will be loaded at the time of booting.

File Syntax

UUID/ Devices Mount Point FStype Mount Optios dump(backup) fscheck

/dev/sda6 /disk6 ext3 default 0 0

Mount Options

(ro – read only ,rw – read write , user- user can mount , 11.02AMonly root can mount , exec – scripts can be
executed , noexec – script / binaries cannot be executed , noauto – it will not mount automatically , auto –
mount automatically , sync input and output will done synchronise ,nosysc, suid , usrquota, grpquota)

Default = (rw,suid,dev,exec,auto,nouser and async)

Dump – backup utility

Fsck – file system check utility


File System Basics

METADATA :

Contains details and backups about the super blocks .Data of data

SUPERBLOCK :

1. First Sector of file system


2. Consists of characteristics of file system
3. Contains details about blocks ,free blocks, filled, etc ,(disk usage information)
4. Contains the location of inode table
5. File system size ,status

#dump2fs /dev/sda1 | grep –i superblock (shows the super block)

INODE :

(Index node) UNIX or Linux never stores file creation time, this is favourite question asked in UNIX/Linux sys admin
job interview

It’s a data structure contains the following information

1. Filetype(block ,executable etc)


2. Permission
3. Owner & group
4. File size
5. File access ,change modification time
6. File deletion time
7. No of Link details
8. ACL

#ls –i => displays the inode value

#stat <File name>


File System Types

EXT2 (Second Extended File System)

1. Does not have Journaling feature


2. Max individual file size 16GB to 2 TB
3. Max individual file system size is 2 TB to 32 TB

EXT 3 ( Third Extended File System)

1. Starting from kernel versions 2.4.15


2. Allows Journaling
3. JOURNALING : Dedicated area in the file system ,where all the changes are tracked .The possibility of
filesystem corruption is less at system crashes.
4. Max individual file size 16GB to 2TB
5. Max File system Size is 2 TB to 32 TB
6. We can restore ext2 to ext3 without any data backup
7. 32,000 sub directories can be created

EXT 4 ( Fourth Extended File System)

1. Starting from kernel 2.6.19


2. Support huge individual size and overall file system
3. Max individual file size 16 GB to 16 TB
4. File System size is 1 EB (1EB=1024 PB ,1 PB = 1024TB)
5. 64,000 sub directories can be created
6. Ext3 can be mounted as ext4 without upgrade
7. We can turn off journaling feature
8. New features ( e.g. Fastfsck , multiblock allocation ,delayed allocation journal checksum etc )

File System Conversions

Converting EXT 2 EXT 3


Change the fstab entry filesystem as Ext 3 reboot .

Converting EXT 3 EXT 2


#tune2fs –o ^has_journal /dev/sda1 => Disabling journal feature
# e2fsck –y /dev/sda5

Converting EXT 3 EXT 4


#tume2fs -o extends, uninit_bg, dir_index /dev/sda5
#fsck –pf /dev/sda1
USER AND GROUP MANAGEMENT

Type of Users

Linux consists of three types of users. (each user and group have unique uid and gid )
1.System User (id 0 -499 )
2.Local User (> 499)
3.Root User : id 0

When Adding User

useradd #usedadd username adduser also there link file of useradd

 While creating a user the /etc/default/useradd will be referred for creating home directory ,
allocating shell ,Home directory etc.
 /etc/login.defs User related controls can be set there (umask , password expire, mail etc)
 While creating a User , Three files will be gets updated
/etc/passwd , /etc/shadow , /etc/group

User ,Group add / del command

 #usedadd -M = home directory cannot be created , -m directory will be created


-d = Created a used mentioned directory as home directory
-e = refers the expire date for the user
-f = user will be in inactice
-s = to set the default shell
-k = skell
-c = gocs value

 Assigning Password: passwd username ( before assigning Password the used is in locked stat)
Options:
-f = force the user to change the passwd for next logon
-h =changes the home directory
-n = minimum days -w warn days -x max days
Passwd encryption - MD5 Message Digest version 5 & DES Data Encryption Standard

 groupadd and groupdel similar to useradd/del

 Userdel
#userdel username (or) userdel –r username (deletes the user home directory)

 pwck & grpck used to verify the passwd group and shadow files

#Cat /etc/default/useradd
GROUP=100
HOME=/home
INACTIVE=-1
EXPIRE=
SHELL=/bin/bash
SKEL=/etc/skel
CREATE_MAIL_SPOOL=yes

Configuration files

 /etc /passwd ->


Username : encrypted password : uid : gid : gcos : homedirectory : shell
Natu: rhfnkdfg23vdf :502:502:natarajan : /home/natu : /bin/bash

 /etc/group
groupname : encrypted passwd : gid : grouplists (contains users list which belongs to group)

 /etc /shadow

Natu : $1$bXAgOfrO$OYBpSuijdJDj4DloAyoan0 : 15782 : 0 : 99999 : 7 : : :

natu:!!:15782:0:99999:7::: (! – denotes that used is in locked state)

1. username:
2. Encrypted passwd
3. Last passwd changed - shows the date in which the password was lastly changed
4. Min passwd Age - min no of days left before the user changes his passwd
5. Max passwd Age - max no of days left before the user changes his passwd
6. Warn days - no of days the user get the warn messages for his passwd change
7. Passwd Inactive days - no of days after the passwd expires and account disabled
8. Account Expire - date when the user account gets expires
9. Flag -kept unused for future purpose

User Modification Commands

Changing Username : usermod -l oldname newname


Locking the User : usermod -L username
Unlock the user : usermod –U username
Changing the userid : usermod –u 615 username
Changing the groups : usermod –G groupname username (secondary Group)
usermod –g groupname username (Primary Group )

Passwd / Shadow backup files


/etc/shadow-
/etc/passwd - We can use this file original files corrupted

pwconv
Creates new shadow file by referring existing passwd file
pwunconv
Creates passwd file by referring passwd and shadow file and removed shadow. or shadow-

Similarly grpconv & grpunconv does the same for group


File Permissions

Permissions for Files and Folder will be assigned based on the default UMASK value.

/etc/bashrc file describes the default UMASK value (can be changed )

Default Umask for root user 022


Default Umask for Local user 002

Default Permissions
Root Normal User 4-write
644 for file 665 for file 2-read
755 for folder 775 for folder 1-execute

# ll –to view file permissions

drwxr-xr-x 2 root root 4096 Mar 16 10:52


syntax : filetype owner group others

file type (d –directory ,l – link file , b- block device , c – character device)


Character device – device in which data transfer will be single character (kbd,mse)
Block device - device in which data transfer will be in blocks (hdd)

Changing Permissions
We can change the file permissions in two ways
(i) Letters method
(ii) Number method

Number Method :-
# chmod 777 filename
# chmod 422 filename

Letter Method :-
#chmod [ u g o a ] [ + - = ] [ r w x ]
a (every one)

# chmod u+rw filename

Changing Owners and Groups:

#chown owner:group filename =>for changing ownership & group


#chgrp group filename => changing group of a file
Special Permissions

 setuid : ( S,4 ) the user who access the file will get the privilege of owner of that file ( scripts )

Eg: /etc/passwd file ,when useradd command executed by user its get modified with root privilege

#chmod u+s filename (- & 0 will remove permission)


#chmod 4777 filename

 setgid : (G ,2)
the user who currently accessing the files and folders will get the owners group permissions.
(for Directories setgid will be assigned )(mails dir )

#chmod g+s filename (- & 0 will remove permission)


#chmod 2777 filename

 Stickybit: ( t ,1)
The owner of the file can able to delete the file if sticky bit is assigned.can be assigned for
folder and file.(tmp will be assigned with sticky bit)

#chmod +t filename (- & 0 will remove permission)


#chmod 1655 filename

ACL – Access Control List

By using ACL We can assign the permission to user or group who are all related or non related to
Owners group. ACL can be set to directory or files

Filesystem should be loaded in ACL options (make entry in fstab in options with ACL)

To assign the ACL

#Setfacl –m u:username:rw- filename

#Setfacl -mR u:nat: rw /home/natdir (-R for Recursive assigned for all the files in that directory )

To List the ACL lists of particular file

#getfacl filename

To check the ACL set files


#ls –la

drwxrwxrwx + (+ refers that particular file is assigned with acl)

How to remove ACL

#setfacl –b natdir (it will remove the ACL for the Directory , -R for recursive)

Hardlinks :

# ln source/target file linkfile

(i) Having the Same inode value


(ii) Can not be extended across the file system as its having same inode value
(iii) If source file deleted ,linked file can be used
(iv) File size will be same
(v) Like backup file

Softlinks :

#ln –s source/target file linkfile

(i) Different Inode value


(ii) Can be extended to partitions
(iii) If source file deleted link file will not able to work
(iv) File size will be no of characters of source file name
(v) Like shortcut
Logical Volume Manager

How to create a Logical Volume

 We need to create a Physical volume


# pvcreate /dev/sda5 /dev/sda6 (initializing the PV ).

 We need to create a Volume Group


# vgcreate vgname /dev/sda5 /dev/sda6

 We need to create the Logical Volume


# lvcreate –L 500M -n lvname vgname

-----------------------------------------------------------------------

Physical Volume Administration

 To Create / Initialize PV
#pvcreate /dev/sda1

If we are using whole hdd as pv then it should not contain partition table so for removing partition table we
need to rewrite the first 512 MB
# dd If =/dev/zero of=/dev/sda bs=512 count=1

 To View Physical Volume


# pvscan , #pvdisplay #lvmdiskscan #pvs

 To change the attributes of Physical Volume


#pvchange
eg: to prevent the allocation of PV
#pvchange -x n /dev/sda5 & for enabling # pvchange –x y /dev/sda5
eg: inactive / active
# pvchange –a n /dev/sda5 & for active #pvchange –a y /dev/sda5

 To Move the data of one PV to another PV


# pvmove /dev/sda5 /dev/sda6 (data form sda5 will move to sda6 )

 To remove PV from a VG
# vgreduce vgname /dev/sda5

 To remove/delete PV permantly
# pvremove /dev/sda5

Volume Group Administration

 To Create a volume Group


#pvcreate /dev/sda5 /dev/sda6
#vgcreate vgname pv1 pv2
# vgcreate vgname /dev/sda5 /dev/sda6
# vgcreate –c vgname /dev/sda5 /dev/sda6 (for cluster )

 Options while creating a VG


(i) Create by using PE EXTEND size
#vgcreate -s 50 vgname /dev/sda5 /dev/sda6

(ii) Limiting no of PVs in VG


#vgcreate -p 3 vgname /dev/sda5 /dev/sda6 /dev/sda7 (only 3 pv can be added )

(iii) Limiting the no of LVs created in VG


# vgcreate – l 10 vgname /dev/sda5 /dev/sda6 .. (max 10 lv can be created in this VG)

 To display the VG
Vgs , vgdisplay , vgscan

 Changing attributes of VG
# vgchange
For deactivate / activating VG
Eg: #vgchange -a n vgname & to activate #vgchange –a y vgname (-l for no of logical volumes)

 VG split
#vgremove existing vgname newvgname /dev/sda8
(/dev/sda8 will be added to the newvg from the existing vgname)

 VGMerge
#vgmerge -v newvg oldvg (oldvg will be merged with newvg )
(vg to be merged should be inactive)

 Extending and Reducing VG


(i) Adding a PV to a VG
#vgextend vgname /dev/sda7 (sda7 will be added to Vg)

(ii) Removing a Unused PV from VG (check with the PVSCAN for usage)
#vgreduce vgname /dev/sda7

(iii) Removing Used PV from VG (check with the PVSCAN for Usage)
#pvmove /dev/sda7 /dev/sda6
#vgreduce vgname /dev/sd7

 Backup / Restoring VG MetaData


Vgcfgbackup /dev/vg1 & vgcfgrestore /dev/vg1 (backup/restore only configuration ,metadata)

# vgcfgbackup -f /tmp/vg01backup vgname (-f = file name)

# vgcfgrestore -f /tmp/vg01 -n vg01 (-n = name of the volume group to be restored )

 Renaming a VG
# vgrename old_name new_vg_name

 Remove a VG
#vgremove vgname

Exporting a VG and Import in Another system without loss of data

1.unmount the Logical Volumes created on that VG


#umount /dev/vg1/lv1

2.Make the Vg as inactive


#vgchange –a n vgname

3.Make the Vg to exported state by using vgexport command


#vgexport vgname

4.check the state of pv using pvscan


#pvscan ( check PV in exported state ..Output : PV /dev/sda1 is in exported VG vg1 [17.15 GB / 7.15 GB free])

5.Remove the Physical disk and Connect to another Pc

6.Use blkid command to check the connected hardisk

7. import the vg : #import vgname


8.Active the Vg : #vgchange –a y vgname
9. mount the lvm : Mount /dev/vg1/vl1 /mnt

Logical Volume Administration

 To Create a LV
# lvcreate –L 5G -n lvname vg1 (default lvname is lvol)
(or)
#lvcreate –l 50% -n lvname vg1
#lvcreate -l 100%FREE -n lvname vg1
#lvcreate –l 10 -n lvname vg1 (10- PE-extends)
#lvcreate –l 100 -n lvname vg1 /dev/sda4:0-50 /dev/sda5:0-100
The LV spread across the Sda4 area PE 0-50 & PE 0-100 of /dev/sda5

 To create a Striped Volume


# lvcreate -l 5G -i2 -I64 -n lvname vg1
-i2 = no of physical volumes I64 = Stripped volume size

 To create a Mirror volume


#lvcreate –l 5g –m1 –n lvname vg1 (m1= no or mirror copies)

 Displaying logical Volumes


#lvdisplay , lvscan , lvs

 Renaming Logical Volumes


# lvrename /dev/vg1/oldlv /dev/vg1/newlv

 Extending / Resizing the Logical Volumes


#lvextend –L 500M /dev/vg1/vl1 (or) lvresize –L 500M /dev/vg1/lv1

#resize2fs /dev/vg1/lv1 ( Effect the changes)

 Reducing the Logical Volumes


1.Unmount the file system
#umount /dev/vg1/lv1

2.Run e2fsck
#e2fsck -f /dev/vg1/lv1

3.resize2fs /dev/vg1/lv1 500M (datas in lv1 will be fragmented within 500m)

4.lvreduce –L 400M /dev/vg1/lv1 (or) lvresize -L 400M /dev/vg1/lv1

Trouble Shootings and notes


# lvmdump
/etc/lvm/backup – contains the Last backup of lvm metadata
/etc/lvm/archive – contains the archive versions
#lvm dumpconfig -command to check the current configuration

RAID – Redundant Array of Independent Disk

Creating a RAID 5 array using below command


#mdadm –create --level=5 --raid-disks=3 /dev/md0 /dev/sda /dev/sdb /dev/sdc

Add newly created RAID array configuration to "/etc/mdadm.conf" file.


#ARRAY /dev/md0 level=5 num-devices=3 devices=/dev/sda,/dev/sdb,/dev/sdc

Create a filesystem on the array


#mkfs.ext4 /dev/md0

Creating a mount point and mounting the Array


#mkdir /Raid5

#mount /dev/md0 /Raid5

Make the desired entries inside "/etc/fstab"


/dev/md0 /Raid5 ext4 defaults 0 0

Reboot the system for applying the changes.


#init 6

To check the status


#cat /proc/stat

For checking the details regarding the existing RAID array we can use the below command.

#mdadm --details /dev/md0

If any disks are found faulty then we can unmount the array and make the array inactive using below command

#mdadm -S /dev/md0

After this we can add new disk and make the desired changes in the "/etc/mdadm.conf" file and reboot the
system.
SWAP :

Free size from Hardisk it can be used by system as a virtual memory .In linux normally swap size will be
double of RAM size.

 Create a new filesystem /dev/sda6


 mkswap /dev/sda6
 swapon /dev/sda6
 swapon –s to check the swap status

swapon –a refresh the swap in fstab entries

To remove the Swap partition : # swapoff /dev/sda6

# free –m to check the free swap spaces. (as well as top )

Disk Quota :

Allocating disk space for the specific user.Need to assign usrquota grpquota options in fstab entry.

 Hardlimit
 Softlimit
 Grace period

#quotacheck –cavug (a – check all quota enabled file system ,v- verbose,u –user ,g- group,c-create quota
database)
Quota ckech is used to scan the file system for disk usage and updates the quota record file
quota.user

#quotaon –av  enabling file system with quota


#quotaoff disabling quota in the file system

edquota –u username -g groupname


repquota  to display the quota limits

for monitoring
/etc/cron.daily/quotacheck
Quotacheck.avug
Backuping Tools

DD command :

Backuping entire hard disk

#dd if=/dev/sda of=/dev/sdb ( if input file , of output file )

Creating a img of hardisk

#dd if=/dev/sda of=~hdd.img

Restoring hard disk image

#dd if=~hdd.img of=/dev/sda

Cdrom

#dd if=/dev/cdrom of=name.iso bs=2048

Tar Command:

Creating backup file


#tar –cvwf newfile.tar file1 (file1 will be backuped)

c create , v  verbose , w user acknowledgment , f argument for mentioning the file name.

#tar –xvf newfile.tar ( to extract the tar file x-extract )

To extract the Single file


#tar –xvf newfile.tar file1

To extract except some files


#tar –xcf newfile.tar --exclude file2 (except file1 all otherfiles will be extracted)

To extract in particular location


#tar –xvwf newfile.tar -C /tmp/nat/ (file will be extracted in this location)

Rsync (Remote Synchronise) Package : rsync

Features:
Speed (at first backup its backups whole data and next time only backups changed blocks )
Security (transferring using SSH )
LessBandwidth (data will be compressed while sending and decompressed at receiving end)
Network backup

Syntax

#rsync -options source destination

Local :

#rsync -zvr /natu/file /tmp/ ( z enable compression , v – verbose , r-Recursive)

For Preserving Symbolic Links,Permissions,owner& group,timestamps

#rsync -azv /natu/file /tmp

Local to network

# rsync -azv /root/tmp [email protected]:/home/tmp

Remote Shell

#rsync -avz -e ssh [email protected]:/home/tmp /root/tmp

Not to overwrite the Modified file : -u #rsync –auzv

-d  only takes directory tree structure

--progress  to view the progress

--delete  delete the files in target location which are all not available in Source.

-i  to compare the difference from source to destination

--include  include the particular file

--exclude  exclude the particular file

# rsync –zvar include new* –exclude old* /var/tmp /home/new

--max-size  (--max-size=100m) it will not allow file more than 100k

-W whole file
Network Configuration

Vim /etc/sysconfig/network

NETWORKING = yes
HOSTNAME=nat.rhel.com
GATEWAY =
GATEWAYDEV = (device eth0)
NISDOMAIN =

Vim /etc/resolv.conf

Search domainname (rhel.com ,example.com)


nameserver

Vim /etc/sysconfig/network-scripts/ifcfg-eth0 (or) eth0:0 alias for network

DEVICE =
BOOTPROTO =
ONBOOT =
IPADDR =
NETMASK =
USRCTRL =
IPV6INIT =
HWADDR =
NM_CONTROLLED =

Vim /etc/hosts

Ipaddress fqdn name name

10.30.37.123 nat.rhcl.com natrhel5


FTP Configuration

Its a method of data transfer over the network ,a standard network protocol

File Transfer Protocol

Package : vsftpd (very secure ftp)


Port :20 , 21
Service :service vsftpd start/stop/restart
Configuration file : /etc/vsftpd/vsftpd.conf
Enabling : chkconfig vsftpd on
(chkconfig for enabling service in desired run level)

#yum install vsftpd

After installation you will be created with the /ftp/pub directory in /var

By default anonymous user will be enabled (can able to read, download but unable to upload )

#vim /etc/vsftpd/vsftpd.conf

Anonymous

anonymous_enable=NO
local_enable=YES this to allow local users to log in (uncomment = disable)
anon_upload_enable=YES (anonymous can upload ,uncomment = disable)
WRITE_ENABLE=YES  TO ENABLE THE UPLOAD

Chroot

Users in the chroot is will get their home directory as the root directory. So that the user cannot able to
access other directory except his home directory. Chroot users also known as JAILED Users

chroot_list_enable=YES
chroot_local_users=yes
chroot_list_file=/etc/vsftpd/chroot_list

Restrict the User access


We can the restrict the user for accessing the FTP.
userlist_enable=YES ( The users mentioned in the userlist file can’t access the FTP , even not given
by password prompt )
userlist_file=/etc/vsftpd.user_list

If you want to allow the users in this user_list file


userlist_deny=NO (This will allow the user in the user_list file )

/etc/vsftpd/ftpusers

Users in the ftpuser are not allowed for login , if we are commenting any user in this file,it will allow the
user for accessing the FTP

If userlist_enable=no

ftp refers ftpusers file ,if it is yes it will look ftpusers and user_list

THEN,

Restart the Daemon


#service vsftpd restart

Access :

ftp://10.30.37.250

NFS - Network File System

Package : nfs-utilis
Port : 2049
Service :service nfs start/stop/restart
:Service portmap
Configuration file : /etc/exports
Enabling :chkconfig nfs on

Installation:

# yum install nfs-utilis

We need to check the rpcinfo services are running .


#rpcinfo -p

Create a directory which you want to share through NFS

#mkdir nfs_share

Change the Permission for others also (change according to you need )

#chmod 777 nfs_share

Now Put entry in /etc/exports

#vim /etc/exports

Syntax : Directory with full path domain(or)ipseries / Netmask (Options)

/nat_share *.rhel.com(rw,no_root_squash)

Options: ( rw ,ro, sync, async, no_root_squash ,root_squash , all_squash )

rw  read& write

sync synchronise of data ,async

no_root_squash It will allow root uid 0 as super user

root_squash  Teat Uid 0 as nfsnobody (default user like anonymous)

wdelay  write operation will be processed as per requests queue.

Starting the Daemon Services :

Service portmap start /restart/stop/reload

Service nfs start/restart/stop/reload

Chkconfig portmap on

Chkconfig nfs on

Checking the Exported files:

#showmount –e localhost/ipaddress
exports –v

exportfs –r  refreshes the entry in /etc/exports

exportfs –a  exports all the directories in /export file

exportfs –U  unexports all the shares in export file

Hard mount and Soft Mount:-

The process of continuous retries of data is call Hard mounting. This guarantee the consistency of
data .Waits upto Server response.

With Soft mount repeated RPC failures will make the NFS operation fail.Data consistency is not
guarantee

rpcbind :-This the primary Daemon upon which all gets reply.RPC manages all applications that is using RPC
Specification.By default it uses port 111.need to run on both server and client.

Nfs : Start the RPC process need to share the file

NfsLock :Used to allow nfs clients to lock the files on server via RPC process

# mount -t nfs 192.168.1.100:/data/files /mnt/nfs

df - command used to check the disk usage of nfs mounted file system

nfsstat – Provide useful nfs error statistics

nfsstat – c  clients , nfsstat –s  server

showmount –a shows the currently exported directories


CRONTAB :-

Its is a utility to run the background jobs at regular intervals


Package : crond

Minutes : Hour : day of Month : Month of year : Day of week : command

0-59 0-23 0-31 0-12 0-6 absolute path of command

To edit the crontab entries

#crontab -e

To list the cron jobs

# crontab –l ( list the current users jobs ) (-e  edit )

To view the other users cron jobs

# crontab –u user-l

Scheduling a job more than one time in same day

30 13,18 * * * /home/nat/salaryscript.sh

Runs at 1 PM and 6 PM

Every hour runs

00 09-18 * * * (9-18 => 9am, 10 am ....6 Pm )

To run cron for every minutes

Put * * * * * cmd

To run cron for every 10 min

*/10 * * * * cmd

Keyword Equivalent
@yearly 0 0 1 1 *
@daily 0 0 * * *
@hourly 0 * * * *
@reboot Run at startup.

Crondtab –e

Mail = “natu”  natu user will get the mail

Anacron like cron ,if pc is down the job will be started once the pc gets up. (desktop and Laptops )

Monitoring tools

TOP

Real time view of running system process. update for every seconds.

It will show the following details

 System Uptime
 No of users currently logged in
 Load Average
 Task details – running, sleeping , stopped , zombie
 CPU usage
 Memory (total memory , used , free , buffer )
 Swap memory details
 Process id , User , Priority, command , cpu & mem usage

t  Display the summary information on / off (task and cpu )


m  Memory info on /off
A  sort by top cpu usage / consumers
r  renice
k kills the process
z  color

VMStat

System activity , Memory information etc

Procs : r – waiting to run , b – no of busy process


Memory : swpd – used virtual memory ,free ,buffer cache
Swap : si – memory swapped from disk , memory swapped to disk
IO : bi blocks received from device , blocks sent to device
System : in interupts cs – context
CPU :usertime ,system time idle time , wating time

Vmstat –a  shows the active and inactive memeory

Vmstat 2 executes for ecry 2 seconds

Vmstat –s shows the details in table format

W – Command  we can check the user who are all logged in and what they are doing ,it will show what they
are currently executing

Uptime : shows the uptime of server , load average , no of user logged in

PS : Show the snapshot of currently running process

PID TTY TIME CMD

Ps –ax  show all the process including the background process

Ps –axu  shows the user information

Ps –U natu  shows the process running by user natu

pgrep  To show the process id of particular process


eg : pgrep crond

To display the name of the particular process id

Eg : ps –p 1150  shows the process name

FREE : # free command show the free and user memory details , swap memory details and buffers.

# IOSTAT :

Shows the average CPU load and disk activity.(nfs)

SAR : collects and report the System activity (systat package need to install )

sar- a

# sar –u

Linux 2.6.18-194.el5PAE (dev-db) 03/26/2011 _i686_ (8 CPU)

 Linux 2.6.18-194.el5PAE – Linux kernel version of the system.


 (dev-db) – The hostname where the sar data was collected.
 03/26/2011 – The date when the sar data was collected.
 _i686_ – The system architecture
 (8 CPU) – Number of CPUs available on this system. On multi core systems, this indicates the total
number of cores

# sar –p  show the usage at processor or core wise

#sar –r report the Memory statistics


#sar –S shows the Swap memory statistics

Sar –b  shows over all io statistics

Sar –d shows the activities of individual block devices (mount point , lun , partations )

 tps – Transactions per second (this includes both read and write)
 rtps – Read transactions per second
 wtps – Write transactions per second
 bread/s – Bytes read per second
 bwrtn/s – Bytes written per second

SAR - N :-

#sar -n option

 DEV – Displays network devices vital statistics for eth0, eth1, etc.,
 EDEV – Display network device failure statistics
 NFS – Displays NFS client activities
 NFSD – Displays NFS server activities
 SOCK – Displays sockets in use for IPv4
 IP – Displays IPv4 network traffic
 EIP – Displays IPv4 network errors
 ICMP – Displays ICMPv4 network traffic
 EICMP – Displays ICMPv4 network errors
 TCP – Displays TCPv4 network traffic
 ETCP – Displays TCPv4 network errors
 UDP – Displays UDPv4 network traffic
 SOCK6, IP6, EIP6, ICMP6, UDP6 are for IPv6
 ALL – This displays all of the above information. The output will be very long.
NETSTAT :-

Netstat command displays the various network related information such as Network connection ,
PORTS routing table, interface statistics etc.,

We can check how many ports are in open , using ports form which ipaddress etc

To List all the Ports (listening and non listening Ports )

#netstart -a

Protocal Received Send Local address Foreign address State

#netstat –l  show the listening ports

#netstat –lt(u – udp) show the listening ports of TCP

#netstat –pt Display the program name and program id

Arp – address resolution protocol

#netstat –s shows the statistics of each protocal

IPTRAF :-

Package : iptraf

#iptraf  color full monitor tool

It can provide the following info in easy to read format:

 Network traffic statistics by TCP connection


 IP traffic statistics by network interface
 Network traffic statistics by protocol
 Network traffic statistics by TCP/UDP port and by packet size
 Network traffic statistics by Layer2 address

NMAP :-

Network Mapper – open source network tool for exploration ,security scanning.

NMAP will be the answer for the Below questions

1. What computers did you find running on the local network?


2. What IP addresses did you find running on the local network?
3. What is the operating system of your target machine?
4. Find out what ports are open on the machine that you just scanned?
5. Find out if the system is infected with malware or virus.
6. Search for unauthorized servers or network service on your network.
7. Find and remove computers which don't meet the organization's minimum level of security.

#nmap 10.30.37.123

#nmap 10.30.37.120/255 (or) 10.30.37.* (or) nmap 10.30.37.0/25  total subnet

#namp –iL ( it can redirect the output to the file specified)

#namp –sA  shows the target PC is protected by firewall.

#namp –sP  find out which server and devices are up

-F for fast Scan.

#nmap –open 10.30.37.123  shows only the open ports

#nmap -iflist 10.30.37.123  shows host interface and routes

#namp –r  shows the kernel routing info

#netstat –ap  all ports (grep the program ssh,etc.,)

Tcpdump :-

The tcpdump is simple command that dump traffic on a network.Detailed network traffic analysis

#tcpdump – i. eth0 ‘udp port 53 ‘


21 FTP
22 SSH/SFTP/SCP
23 Telnet
23 SMTP Mail Transfer
53 DNS
80 HTTP
110 POP
111 rpc bind
143 IMAP
443 HTTP
3128 squid
389 ldap

--------------------------------------------

SAMBA : -

It uses the SMB protocols – Server Message Block . Sharing linux and windows

Package : Samba, Samba-common , Samba-clients , swat (samba web admin tool )

Port : 445
Service : service smb start , service nmbd start

Configuration file : /etc/samba/smb.conf , /etc/samba/smbpasswd


Enabling :chkconfig smb on

[global] [pub] [home] in configuration file

#yum install samba*

#service smb start

To check the local pc shared files

#smbclient –l localhost –N ( suppresses the normal password prompt from the client to the user )

#vi /etc/samba/smb.conf
public ==> share can be accessed by guest
browseable ==> share is visible in browse lists
writable ==> resource is read and write enabled
printable ==> resource is a printer, not a disk
group ==> all connections to the share use the specified GROUP as the primary group

Testparm – used to check the syntax of configuration file

smbpasswd –a username -> to create samba passwd

smbpasswd –e username -> to enable samba passwd

From Client :

Smbclient //10.30.37.254/home/nat –U natu

--------------------------------------------

NIS  Network Informtion Service

Package : ypserv , portmap (server )

:ypbind,yp-tools,portmap,authconfig,authconfig-gtk (client)

Port : No dedicated port


Service : service ypserv start / portmap
Configuration file : /etc/sysconfig/network “NISDOMAIN=rhce”

Install the Package:

Yum install ypserv & yum install portmap

#vim /etc/sysconfig/network

NISDOMAIN =”rhce”

To set the nisdomain name : nisdomainname RHCE

Create a directory and create the user and assign the directory as its home directory

Create passwd

Exports its home directory


Create the NIS database

#/usr/bin/yp/ypinit –m

Start yppasswd service

From client

#authconfig-tui enter the Nis domain name ypbind should start automatically.

Check by getent passwd .

--------------------------------------------

AutoMounting :-

Package : autofs

#vim /etc/auto.master

/rhome/user /etc/auto.mis --timeout=60

/localdirectory file need to refer timeout

#vim /etc/auto.misc

User -fstype=nfs 10.30.37.254:/rhome/user

Dir -rw,soft,init, nat.rhel2.com/directory need to mount

Service autofs start

Service ypbind start

--------------------------------------------

SQUID :-

Package : From client

Configuration file : /etc/squid/squid.conf


Port no : 3128

Search for the text in squid.conf “ournetwork”

http_access allow localhost

http_access deny all

#acl our_networks src 192.168.1.0/24 192.168.2.0/24

#service squid restart

acl blockeddomain dstdomain

"/etc/squid/blocked.domains.acl" separate file contains blocked site details

"/etc/squid/blocked.domains.acl"

1.http_access deny blockeddomain

2.acl blockeddomain dstdomain

WEBSERVER

Package : httpd

Port : 80

Configuration file : /etc/httpd/conf/httpd.conf

#yum install httpd

#vim /etc/httpd/conf/httpd.conf

NameVirtualHost 10.30.37.254:80

<VirtualHost 10.30.37.254:80>

ServerAdmin [email protected]

DocumentRoot /var/www/html/KB-1.1/

ServerName www.nat1.com

<Directory /var/www/html/ >

Allow from ALL


</Directory>

</VirtualHost>

Index file should be In /var/www/html/

For secure web access

<Directory /var/www/virtual>
Allow Override Auth Config
</Directory>

CREATING THE SECURITY


cd /var/www/virtual
vim .htaccess
AuthName "virtual webpage"
AuthType Basic
AuthUserFile /var/www/virtual/pass
require valid-user
CREATING HTPASSWORD TO THE USER
htpasswd -c /var/www/virtual/pass <username>

chmod 640 pass

-------------------------------------------------------------------------

cat /proc/meminfo

SMB, which stands for Server Message Block,

LPT1, LPT2 and LPT3 would therefore be referred to as /dev/lp0, /dev/lp1 Serial ports are identified as /dev/ttyS0

environmental variables is global shell variables.

# %sudo ALL=NOPASSWD: ALL

You might be tempted to uncomment this out so you no longer have to type that sudo password.

username ALL=(ALL) ALL

xinetd listens for incoming requests over a network and launches the appropriate service for that request.
[2]
Requests are made using port numbersas identifiers and xinetd usually launches another daemon to handle
the request. It can be used to start services with both privileged and non-privileged port numbers

a daemon (pron.: /ˈdeɪmən/ or /ˈdiːmən/)[1] is a computer program that runs as a background process, rather
than being under the direct control of an interactive user. Traditionally daemon names end with the letter d: for
example, syslogd is the daemon that implements the system logging facility and sshd is a daemon that services
incomingSSH connections.
In a Unix environment, the parent process of a daemon is often, but not always, the init process. A daemon is
usually created by a process forking a child process and then immediately exiting, thus causing init to adopt the
child process. In addition, a daemon or the operating system typically must perform other operations, such as
dissociating the process from any controlling terminal(tty). Such procedures are often implemented in various
convenience routines such as daemon(3) in Unix.
Systems often start daemons at boot time and serve the function of responding to network requests, hardware
activity, or other programs by performing some task. Daemons can also configure hardware (like udevd on
some GNU/Linux systems), run scheduled tasks (like cron), and perform a variety of other tasks.

Ll command alias
Ls display the directory contents

ls -a (include hidden file)

ls -R (displays files including sub directories)

ls -ld (directory and symlink information)

cp [options] file1 file2 destination


--> cp -i (ask for overwriting a file)

--> cp -r (copy a directory and subdirectry

File -> to ceheck the file type

The more command pauses when the screen fills up and waits for you to press the spacebar before it rolls out
another screenful of text. A legend at the bottom of the screen tells you what percentage of the file has been
displayed so far.
The less command works like more except that it lets you move both forward and backward in the file while the
command is running--use the B key on your keyboard to back up one screen and the spacebar to move forward
and show the next screen.

Head ad tail default 10 lines

# tail -f /var/log/messages – continuous updation

Mail [options] [users]

Options include: -s for subject, -c for carbon copy, -b for blind carbon copy

E.g. mail user_name –s “hello”

Kernel – a small program that communicated the user application and the hardware

Shell - The command interpreter is the interface between the user and the operating system

/ this is top level directory


/root it is home directory for root user(super user)

/home it is home directory for other users

/boot it contains bootable files for linux

/etc It contains all configuration files

/usr By default softwares are installed in /usr directory

/opt It is optional directory for /usr - It contains third party softwares


/bin It contains commands used by all users
/sbin It contains commands used by only Super User(root)
/dev It contains device files
/proc It contain process files Virtual Directory
/var It is containing variable data like mails, log files
/mnt It is default mount point for any partition
/media It contains all of removable media like cdrom, pendrive
/lib It contains library files which are used by OS
/tmp It stored temporary files

pwd.... print present working dir

who ........ to see who is logged in

whoami ..... to show who is working on present terminal

to create dir inside a dir mkdir –p

rmdir to remove directories , rm –r

Touch and cat to create the files

cd - means switch directory to previous directory


cd ~ means go back to home directory of user
cd .. means go to parent directory
cd ../.. means go to 2 level parent directory
cd means go back to home directory of user

ls -l long listing
ls -a list all files and directories
ls -R Recursive order
ls -r reverse order
ls -i to list inode numbers
ll same as 'ls -l'

the output of ll command shows following iformation:-


file type
permissions
links
owner of file
owner's group name
size of file in bytes
date and time of modification
file name
..............................................................................

VI 1 command mode
2 insert mode (edit mode)
3 extended command mode

Find and replace

:<range>s/<find what>/<replace with>/<options>

1,$s/cat/dog/gi
to find cat,CAT,Cat,cAT and replace with dog in complete file

MORE : it will show the pages .unable to scroll , space used to see next screen of file contents

LESS :- we can scroll by using up/down key . q for quit

Head and tail show 10 lines

grep:- Global Regular Expression Print

# ll | grep "^-" , “^d “ directory

# wc –l,w,c line word,character

LINUX SYSTEM

 Installation and configuration of various type of Linux operating system into different type hardware.
 File System Management.
 User and Group Management.
 Working on LVM for dynamically extending and reducing partition size.
 Configuring and Managing LVM & RAID.
 Setting up Disk Quota management as per the customer requirements.
 Installing and Managing Package by using YUM and RPM.
 TCP/IP Configuration of Clients and Servers, Assigning IP address, Gateways, Name servers, net masks, host names,
domain names etc for individual machines and setting up the network.
 Installation and configuration of VSFTP.
 Installation and Configuring DHCP .
 Installation and Configuration of DNS.
 Configuring and Managing File sharing using SAMBA for linux to Windows).
 Configuring and Managing File sharing using NFS.
 Setting up a secure open SSH server and disabling the use of FTP and telnet to increase the network security.
 Job Scheduling and Automating process using CRON.
 Monitoring Disk, CPU and memory & Network utilization (Monitoring tools -TOP ,PS, NAGIOS ).
 Setting up ACL to set owner and group permissions.
 Configuration on POSTFIX and SENDMAIL for mail access.
 Configuration of SQUID.
 Managing Servers Using WEBMIN Management tool.
 Performing backups, restoration, analyzing logs and troubleshooting error as per day to day operation.
 Installing and configuring NIS.
 Configuring Linux Network Installation PXE BOOT, KICKSTART.
 Installation and Configuration of LDAP.
 Installation and configuration RHEL Cluster.
 Handled Severs Remotely (RMM,VMESX).

TCS interview Questions.


1. What is super block?
2. What are the filesystems in linux?
3. Whether Nfs filesystem can set to root?
4. Explain the LVM creation step by step procedure?
5. What are the entries in FSTAB?
6. Diff b/w ext2 and ext3?
7. How to change kernel parameters in linux?
8. What are the raid levels in linux with brief explaination?
9. What is inode? And how to see the inode?
10. What is UMASK?
11. What is the default file permission assing while creat the file and dir?
12. What is SUID,SGID and Stickybit?
13. Diff b/w hardlink and softlink?
14. How do you check the system performance?
15. What are the entries in loadaverage?
16. What is us,sys,idle ?
17. What is metadata?
18. What is router?
19. What is parity?
20. If load average is in normal position but system gets slow, what are the other cause?

Common Interview Question


1. What is sftp?
2. How will you update rpm package
3. How to move physical volume ?
4. What is HBA?
5. Explain yum configuration?
6. What is OS hardening?
7. How to tune the system performance.
8. How will you update the kernel thru Rpm?
9. Explain boot process?
10. Which command for install the rpm?
11. Explain kickstart installation?
12. Explain nfs configution?
13. What is diff b/w ext3 and ext4?
14. Port no?
15. How will you extend the filesystem?
16. What is incremental backup?
17. How to identify LUN ?
18. What is diff b/w /etc/profile and .profile?
19. What are the shells in linux?
20. How to check the hostname?
21. How to see installed packages ?
22. How to see the redhat version?
23. How to check the disk space?
24. How to create partition?
25. How to change the host name?

A Kickstart file contains a series of options, to be passed to the Anaconda installer, that describes how to set up the
system. It may also include custom scripts to be run before or after the installation.

A Kickstart installation[3] follows these four steps:

1. The machine is booted from a CD/DVD, a USB device or over a network using PXE and the network protocols
Dynamic Host Configuration Protocol and Trivial File Transfer Protocol.
2. The Kickstart file is downloaded from the boot media or network (most common).
3. An Anaconda installation is automatically launched and reads the Kickstart file for the location of the Installation
Tree. The tree can reside on the boot media or network.
4. After accessing the Installation Tree, the installer attempts an unattended installation. If any required information is
missing from the Kickstart file, or the file is configured incorrectly, the installer may prompt the user for additional
information.

Redhat Enterprise Linux (RHEL) Install and Configure


MySQL Database Server
by nixCraft on March 20, 2007 · 39 comments· last updated at June 22, 2012
How do I install the MySQL database server under Redhat Enterprise Linux 4 / 5 / 6?

You can install mysql using any one of the following medium.

a) Install MySQL package using RHN or CentOS repo.

b) Install MySQL rpms from CD/DVD media.

Red Hat Enterprise Linux install Mysql database server

Type the following command to install mysql server using the RHN or CentOS repo:

Redhat Enterprise Linux - RHEL 5 / 6 MySQL installation

Type the following command as root user:


# yum install mysql-server mysql

Redhat Enterprise Linux - RHEL 4/3 MySQL installation

Type the following command as root user:


# up2date mysql-server mysql

Start MySQL Service

To start the mysql server type the following command:


# chkconfig mysqld on
# /etc/init.d/mysqld start

Setup the mysql root password

Type the following command to setup a password for root user:


# mysqladmin -u root password NEWPASSWORD

Test the mysql connectivity

Type the following command to connect to MySQL server:


$ mysql -u root -p

Configure the mysql server

Edit /etc/my.cnf, enter (please note that following are sample values, you need to adjust them as per your
requirements):
# vi /etc/my.cnf
You can configure mysql query cache as follows (add in [mysqld] section) to speed up mysql:
query_cache_type = 1
query_cache_limit = 1M
query_cache_size = 32M

You can setup MyISAM buffer size and recover options:

# For MyISAM #
key_buffer_size = 24M
myisam_recover = FORCE,BACKUP

Log slow queries for troubleshooting as follows:

# LOGGING #
log_queries_not_using_indexes = 1
slow_query_log = 1
slow_query_log_file = /var/lib/mysql/mysqld-slow-query.log

Set caches and other limits as follows:

tmp_table_size = 32M
max_heap_table_size = 32M
max_connections = 500
thread_cache_size = 50
open_files_limit = 65535
table_definition_cache = 4096
table_open_cache = 512

Save and close the file. You can reload or restart the changes as follows:
# /sbin/service mysqld restart
OR
# /sbin/service mysqld reload

Most of the Linux distro comes with MySQL. If you want use MySQL, my recommendation is that you download
the latest version of MySQL and install it yourself. Later you can upgrade it to the latest version when it becomes
available. In this article, I will explain how to install the latest free community edition of MySQL on Linux
platform.

1. Download the latest stable relase of MySQL

Download mySQL from mysql.com . Please download the community edition of MySQL for your appropriate
Linux platform. I downloaded the “Red Hat Enterprise Linux 5 RPM (x86)”. Make sure to download MySQL
Server, Client and “Headers and libraries” from the download page.
 MySQL-client-community-5.1.25-0.rhel5.i386.rpm
 MySQL-server-community-5.1.25-0.rhel5.i386.rpm
 MySQL-devel-community-5.1.25-0.rhel5.i386.rpm

2. Remove the existing default MySQL that came with the Linux distro

Do not perform this on an system where the MySQL database is getting used by some application.

[local-host]# rpm -qa | grep -i mysql


mysql-5.0.22-2.1.0.1
mysqlclient10-3.23.58-4.RHEL4.1

[local-host]# rpm -e mysql --nodeps


warning: /etc/my.cnf saved as /etc/my.cnf.rpmsave
[local-host]# rpm -e mysqlclient10

3. Install the downloaded MySQL package

Install the MySQL Server and Client packages as shown below.

[local-host]# rpm -ivh MySQL-server-community-5.1.25-0.rhel5.i386.rpm MySQL-client-


community-5.1.25-0.rhel5.i386.rpm
Preparing... ########################################### [100%]
1:MySQL-client-community ########################################### [ 50%]
2:MySQL-server-community ########################################### [100%]

This will also display the following output and start the MySQL daemon automatically.

PLEASE REMEMBER TO SET A PASSWORD FOR THE MySQL root USER !


To do so, start the server, then issue the following commands:
/usr/bin/mysqladmin -u root password 'new-password'
/usr/bin/mysqladmin -u root -h medica2 password 'new-password'

Alternatively you can run:


/usr/bin/mysql_secure_installation
which will also give you the option of removing the test
databases and anonymous user created by default. This is
strongly recommended for production servers.
See the manual for more instructions.
Please report any problems with the /usr/bin/mysqlbug script!
The latest information about MySQL is available at http://www.mysql.com/
Support MySQL by buying support/licenses from http://shop.mysql.com/

Starting MySQL.[ OK ]
Giving mysqld 2 seconds to start

Install the “Header and Libraries” that are part of the MySQL-devel packages.

[local-host]# rpm -ivh MySQL-devel-community-5.1.25-0.rhel5.i386.rpm


Preparing... ########################################### [100%]
1:MySQL-devel-community ########################################### [100%]

Note: When I was compiling PHP with MySQL option from source on the Linux system, it failed with the
following error. Installing the MySQL-devel-community package fixed this problem in installing PHP from
source.
configure: error: Cannot find MySQL header files under yes.
Note that the MySQL client library is not bundled anymore!

4. Perform post-install security activities on MySQL.

At a bare minimum you should set a password for the root user as shown below:

[local-user]# /usr/bin/mysqladmin -u root password 'My2Secure$Password'

The best option is to run the mysql_secure_installation script that will take care of all the typical security related
items on the MySQL as shown below. On a high level this does the following items:

 Change the root password


 Remove the anonymous user
 Disallow root login from remote machines
 Remove the default sample test database

[local-host]# /usr/bin/mysql_secure_installation

NOTE: RUNNING ALL PARTS OF THIS SCRIPT IS RECOMMENDED FOR ALL MySQL
SERVERS IN PRODUCTION USE! PLEASE READ EACH STEP CAREFULLY!
In order to log into MySQL to secure it, we'll need the current
password for the root user. If you've just installed MySQL, and
you haven't set the root password yet, the password will be blank,
so you should just press enter here.

Enter current password for root (enter for none):


OK, successfully used password, moving on...

Setting the root password ensures that nobody can log into the MySQL
root user without the proper authorisation.
You already have a root password set, so you can safely answer 'n'.
Change the root password? [Y/n] Y
New password:
Re-enter new password:
Password updated successfully!
Reloading privilege tables..
... Success!
By default, a MySQL installation has an anonymous user, allowing anyone
to log into MySQL without having to have a user account created for
them. This is intended only for testing, and to make the installation
go a bit smoother. You should remove them before moving into a
production environment.
Remove anonymous users? [Y/n] Y
... Success!
Normally, root should only be allowed to connect from 'localhost'. This
ensures that someone cannot guess at the root password from the network.
Disallow root login remotely? [Y/n] Y
... Success!
By default, MySQL comes with a database named 'test' that anyone can
access. This is also intended only for testing, and should be removed
before moving into a production environment.
Remove test database and access to it? [Y/n] Y
- Dropping test database...
... Success!
- Removing privileges on test database...
... Success!
Reloading the privilege tables will ensure that all changes made so far
will take effect immediately.
Reload privilege tables now? [Y/n] Y
... Success!
Cleaning up...
All done! If you've completed all of the above steps, your MySQL
installation should now be secure.
Thanks for using MySQL!

5. Verify the MySQL installation:

You can check the MySQL installed version by performing mysql -V as shown below:

[local-host]# mysql -V
mysql Ver 14.14 Distrib 5.1.25-rc, for redhat-linux-gnu (i686) using readline 5.1

Connect to the MySQL database using the root user and make sure the connection is successfull.

[local-host]# mysql -u root -p


Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 13
Server version: 5.1.25-rc-community MySQL Community Server (GPL)

Type 'help;' or '\h' for help. Type '\c' to clear the buffer.

mysql>

Follows the steps below to stop and start MySQL

[local-host]# service mysql status


MySQL running (12588) [ OK ]
[local-host]# service mysql stop
Shutting down MySQL. [ OK ]
[local-host]# service mysql start
Starting MySQL. [ OK ]

How to Install Very Secure File Transfer Protocol Daemon (vsFTPd)

You can use the rpm command to install vsFTPd as shown below.

[root@RHEL04 ~]# rpm -Uvh vsftpd-2.0.5-10.el5.i386.rpm

OR by using the yum command, if you have configured yum properly.

[root@RHEL04 ~]# yum –y install vsftpd

Once vsFTPd is installed, make sure it starts the next time you boot Linux. You can use the ‘chkconfig’ command to make
the vsFTPd start working when you reboot the system.
[root@RHEL04 ~]# chkconfig vsftpd on

Main files and directories Installed with vsftpd

The vsftpd RPM installs the daemon (/usr/sbin/vsftpd), its configuration and related files, as well as FTP directories onto
the system.

The following list shows the main files and directories related to vsftpd configuration:

• /etc/rc.d/init.d/vsftpd: The initialization script (initscript) used by the /sbin/service command to start, stop, or reload
vsftpd.

• /etc/pam.d/vsftpd: The Pluggable Authentication Modules (PAM) configuration file for vsftpd.

• /etc/vsftpd/vsftpd.conf: The main configuration file for vsftpd.

• /etc/vsftpd/ftpusers: A list of users not allowed to log into vsftpd. By default, this list includes the root, bin, and
daemon users, among others, since sending the username and password credentials of sensitive users using clear text is
not secure.

• /etc/vsftpd/user_list: This file can be configured to either deny or allow access to the users listed, depending on
whether the userlist_deny directive is set to YES (default) or NO in /etc/vsftpd/vsftpd.conf. If /etc/vsftpd.user_list is
used to grant access to users, the usernames listed must not appear in /etc/vsftpd.ftpusers.

• /var/ftp/: — The directory containing files served by vsftpd. It also contains the /var/ftp/pub/ directory for anonymous
users. Both directories are world-readable, but writable only by the root user.

vsFTPd configuration file /etc/vsftpd/vsftpd.conf

All configuration of vsftpd can be done by its configuration file, /etc/vsftpd/vsftpd.conf. Each directive is on its own line
within the file and follows the following format:

<directive>=<value>

The lines starting with‘#’ are comments.

vsFTPd daemon Options in /etc/vsftpd/vsftpd.conf

The following is a list of directives which control the overall behavior of the vsftpd daemon.

• listen: When enabled, vsftpd runs in standalone mode. This value is set to YES by default. This directive cannot be
used in conjunction with the listen_ipv6 directive.

• listen_ipv6: When enabled, vsftpd runs in standalone mode, but listen only to IPv6 sockets. This directive cannot be
used in conjunction with the listen directive.

The default value is NO.

Log-in Options and Access Controls in /etc/vsftpd/vsftpd.conf

Anonymous access features can be changed for your FTP server by editing the vsftpd.conf file and changing related
entries to YES or NO in the file. The main setting related with anonymous access are:

• anonymous_enable: Enabled by default. Use a setting of NO, and then restart the server to turn off anonymous access.
• anon_mkdir_write_enable: Allows or disallows creating of new directories.

• anon_other_write_enable: Allows or disallows deleting or renaming of files and directories.

• anon_upload_enable: Controls whether anonymous users can upload files (also depends on the global write_enable
setting).

• anon_world_readable_only: Allows anonymous users to download only files with world-readable (444) permission

• no_anon_password: When enabled, the anonymous user is not asked for a password. The default value is NO.

• banner_file: Specifies the file containing text displayed when a connection is established to the server. This option
overrides any text specified in the ftpd_banner directive.

• cmds_allowed — Specifies a comma-delimited list of FTP commands allowed by the server. All other commands are
rejected.

• ftpd_banner: When enabled, the string specified within this directive is displayed when a connection is established to
the server. This option can be overridden by the banner_file directive. By default vsftpd displays its standard banner.

• local_enable: When enabled, local users are allowed to log into the system.

• userlist_deny: If userlist_deny=NO, only allow users in userlist_file. If userlist_deny=YES (default), never allow users
in userlist_file, and do not even prompt for a password.

• userlist_enable: When enabled, the users listed in the file specified by the userlist_file directive are denied access.

• userlist_file: Specifies the file referenced by vsftpd when the userlist_enable directive is enabled. This file is created
when vsftp is installed and is located in /etc/vsftpd/user_list.

• ftp_username: Specifies the local user account (listed in /etc/passwd) used for the anonymous FTP user. The home
directory specified in /etc/passwd for the user is the root directory of the anonymous FTP user. The default user is ftp
and default home folder is /var/ftp/.

• chroot_list_enable: When enabled, the local users listed in the file specified in the chroot_list_file directive are placed
in a chroot jail upon log in. If enabled in conjunction with the chroot_local_user directive, the local users listed in the file
specified in the chroot_list_file directive are not placed in a chroot jail upon log in. The default value is NO.

• chroot_list_file: Specifies the file containing a list of local users referenced when the chroot_list_enable directive is set
to YES. The default value is /etc/vsftpd/chroot_list.

• chroot_local_user: When enabled, local users are change-rooted to their home directories after logging in. The default
value is NO.

Other important options in /etc/vsftpd/vsftpd.conf

• dirlist_enable: When enabled, users are allowed to view directory lists.

• write_enable: When enabled, FTP commands which can change the file system are allowed.

• accept_timeout: Specifies the amount of time for a client using passive mode to establish a connection. The default
value is 60.

• anon_max_rate: Specifies the maximum data transfer rate for anonymous users in bytes per second. The default value
is 0, which does not limit the transfer rate.
• connect_timeout: Specifies the maximum amount of time a client using active mode has to respond to a data
connection, in seconds. The default value is 60.

• idle_session_timeout: Specifies the maximum amount of time between commands from a remote client. Once
triggered, the connection to the remote client is closed.

• listen_address: Specifies the IP address on which vsftpd listens for network connections. There is no default value for
this directive.

• listen_address6: Specifies the IPv6 address on which vsftpd listens for network connections when listen_ipv6 is set to
YES. There is no default value for this directive.

• listen_port: Specifies the port on which vsftpd listens for network connections. The default value is 21.

• local_max_rate: Specifies the maximum rate data is transferred for local users logged into the server in bytes per
second. The default value is 0, which does not limit the transfer rate.

• max_clients: Specifies the maximum number of simultaneous clients allowed to connect to the vsFTPd server when it is
running in standalone mode. Any additional client connections to the vsFTPd server would result in an error message.
The default value is 0, which does not limit connections.

Release:
Red hat Linux 5.2

Problem:
Users are notable to login to system. Error Message "GDM Couldn't write the authorization
file"

Solution:
1.Log in as root user.
2. Check root (/ file system usage)
3. Found the root (/) file system is used 100%
4. Deleted files under /tmp location and unwanted other file
5. Found /var/log/messages file is occupying 5.07 GB space
6. Cleared messages file content
echo 1 > /var/log/messages
7. Tested the root (/) file system is having more then 65% free space.
8. Rebooted system ad checked all the users able to login.

Kernel panic

Release:
RedHat Linux 5.x

Problem:
System not booting into Operating system. Showing kernel panic error - File system
check filed for /home, Manually run file system check.
Solution:
Type root password in CTRL+D Prompt, Press enter and get into maintenance mode.
Enter fdisk -l command and get list of available partition's
/dev/hda1
/dev/hda2
/dev/hda3
/dev/hda4 Extended
/dev/hda5
/dev/hda6
/dev/hda7
/dev/hda8 Linux Swap.

Find the file system name using e2label command

e2label /dev/hdax
/dev/hda1 /boot
/dev/hda2 /home
/dev/hda3 /
/dev/hda5 /usr
/dev/hda6 /var
/dev/hda7 /tmp

Since the /home is separate file system, Confirm the file system /home (/dev/dha2)
is not mounted by entering mount command. If file system is not mounted run fsck
from maintenance mode.

fsck /dev/hda2

Select Yes to Fix the corrupted inodes

After completing Exit from rescue mode and rebooted system.

Note:-
It is not recommended to run file system check for mounted file system. If the
file system is mounted in maintenance mode un-mount it and run Fsck. If un-mount
fails boot system from Red hat linux OS Installation CD, Enter into rescue mode by
Skipping file system mounting and run file system check (fsck).

Solution
Recovering corrupted File system in RHEL ID
: 21901
Type : Solution | Updated On : Jul 26, 2012 03:26 PM Status : Approved
Category: Operating Systems > RedHat Linux

Release:
Red Hat Enterprise Linux 3.x / 4.x

Problem:
Server is giving file system inconsistency error while booting. Asking root
password for maintenance.
Solution:
Trouble shooting in Linux rescue,

Boot through RHEL Ist CD. At boot: prompt type as follows

1) Boot: linux rescue


2) Now machine will boot to Linux rescue mode. when it asks for mounting the file
systems ,it will show three options to select,” Continue" ,"Read only " and
"Skip".
3) Select Skip and enter, immediately it will come to shell where no file systems
are mounted.
4) Type the following command
#vgscan
5) The above command will create /etc/lvmtab file and will show the volume group
name if it detects any, in this case it found Volume00.
6) Next detected VG should be activated. To activate Volume group Volume00, give
the command
#vgchange -a y /dev/Volume00
7) Now we can able to access available logical volumes and able to run file system
check on those.
#fsck /dev/Volume00/LogVol00
8) This was completed after fixing some errors.
9) If inconsistency found in other file systems, then it can be run separately for
/dev/Volume00/LogVol01, Logvol02, etc…
10) Exit from the shell and boot the server.

Note:
The above solution is specific for the system which is configured with LVM for
root filesystem. In place of /dev/Volume00/LogVol00, you have to place appropriate
devices name for root filesystem which can be get from fdisk -l output.

Installtion of Qlogic QLA2460 FC card in RHEL 4:


Problem with Driver.Asked CE to reinsatll RHEL OS again and then call ERC to load qlogic FC card.Installed RHEL4 and
copied qlafc.8.01.01.tar file to linux PC and extracted.
One Directory named qlafc.8.01.01-install will be created,then
#cd qlafc.8.01.01-install
#./qlinstall -i (To install the fibre channell card driver)
Once it is completed successfully , Restart the server .After restarting the server , please confirm the driver intialiazation
using following command,
# lsmod | more
It will display installed modules as follows,
qla2xxx_conf 305924 1
qla2xxx 257912 0
intermodule 8196 2 qla2xxx,qla2xxx_conf
Invoke to that qlafc.8.01.01-install Directory and execute
#./qlinstall -dl
It will show device list which is connected with this card,Otherwise we can start Sansurfer utility to manage the card, To
invoke Sansurfer CLI utility,give following command,
#./qlinstall -s
All the connected storage devices are getting detected through this card,Working fine,Tested ok .
How I Simplified Oracle Database 11g Installation on Oracle
Linux 6
by Ginny Henningsen; updated by Michele Casey

How to simplify the installation of Oracle Database 11g on Oracle Linux 6 by installing the oracle-rdbms-server-11gR2-
preinstall RPM package.

Published September 2012

Note: This article applies to Oracle Linux 6. A previous article, "How I Simplified Oracle Database
Installation on Oracle Linux," describes how to perform a similar task on Oracle Linux 5.

Introducing the oracle-rdbms-server-11gR2-preinstall RPM for Oracle Linux

Before installing Oracle Database 11g on a system, you need to preconfigure the operating environment
since the database requires certain software packages, package versions, and tweaks to kernel
parameters. (Be sure to review the appropriate Oracle Database installation guide to familiarize yourself
with hardware, software, and operating system requirements.)
If you'd like to download
software, participate in forums,
and get access to other
On Oracle Linux, I discovered that there is a remarkably easy way to address
technical how-to goodies in
these installation prerequisites: First install an RPM package called oracle- addition to content like this,
rdbms-server-11gR2-preinstall. This RPM performs a number of become an OTN member. No
preconfiguration steps, including the following: spam!

 Automatically downloading and installing any additional software packages and specific
package versions needed for installing Oracle Grid Infrastructure and Oracle Database 11g Release 2 (11.2.0.3), with package
dependencies resolved via yum or up2date capabilities.
 Creating the user oracle and the groups oinstall (for OraInventory) and dba (for OSDBA), which are used during
database installation. (For security purposes, this user has no password by default and cannot log in remotely. To enable remote
login, please set a password using the passwd tool.)
 Modifying kernel parameters in /etc/sysctl.conf to change settings for shared memory, semaphores, the maximum
number of file descriptors, and so on.
 Setting hard and soft shell resource limits in /etc/security/limits.conf, such as the locked-in memory address space,
the number of open files, the number of processes, and core file size.
 Setting numa=off in the kernel for x86_64 machines.

Note that oracle-rdbms-server-11gR2-preinstall parses the existing /etc/sysctl.conf and


/etc/security/limits.conf files and updates values only as needed for database installation. Any
precustomized settings not related to database installation are left as is.

The oracle-rdbms-server-11gR2-preinstall RPM package is accessible through the Oracle


Unbreakable Linux Network (ULN, which requires a support contract), from the Oracle Linux distribution
media, or from the Oracle public yum repository. Thus, whether or not your system is registered with
ULN to access Oracle patches and support, you can use oracle-rdbms-server-11gR2-preinstall to
simplify database installation on Oracle Linux. In addition, the Oracle public yum repository now
includes all security and bug errata, ensuring systems are secured and stable with the latest security
updates and bug fixes.

Installing the oracle-rdbms-server-11gR2-preinstall RPM

The remainder of this article steps through the procedure that I used for installing oracle-rdbms-server-
11gR2-preinstall on Oracle Linux via the Oracle public yum repository. I started with a system running
Oracle Linux Release 6 Update 3 for x86_64, a 64-bit version of Oracle Linux that I downloaded from
the Oracle software delivery cloud (requires registration or login). First, I set up a yum configuration file
that pointed to the correct repository, and then I installed the oracle-rdbms-server-11gR2-preinstall
RPM from that repository.

Here are the steps for preconfiguring a system for Oracle Database installation using oracle-rdbms-
server-11gR2-preinstall:

1. As an authorized user (for example, root), retrieve the file that configures repository locations:

2.
3. # cd /etc/yum.repos.d
4.
5. # wget http://public-yum.oracle.com/public-yum-ol6.repo
6.
7. Using a text editor, modify the file, changing the field enabled=0 to enabled=1 to reflect repositories that correspond to the
machine's operating system release.

Here is an excerpt of public-yum-old6.repo with the changed lines in boldface.


[ol6_latest]

name=Oracle Linux $releasever Latest ($basearch)

baseurl=http://public-yum.oracle.com/repo/OracleLinux/OL6/latest/$basearch/

gpgkey=http://public-yum.oracle.com/RPM-GPG-KEY-oracle-ol6

gpgcheck=1

enabled=1

[ol6_UEK_latest]

name=Latest Unbreakable Enterprise Kernel for Oracle Linux $releasever ($basearch)

baseurl=http://public-yum.oracle.com/repo/OracleLinux/OL6/UEK/latest/$basearch/

gpgkey=http://public-yum.oracle.com/RPM-GPG-KEY-oracle-ol6

gpgcheck=1

enabled=1

Because the target system is running Oracle Linux Release 6 Update 3 for x86_64, which installs
the Oracle Unbreakable Enterprise Kernel by default, there are two repositories to enable,
[ol6_latest] and [ol6_UEK_latest].

8. Next, install the oracle-rdbms-server-11gR2-preinstall RPM using the yum install command.

The output in Listing 1 shows how the installation checks dependencies and then downloads and
installs the required packages.

# yum install oracle-rdbms-server-11gR2-preinstall

Loaded plugins: refresh-packagekit, rhnplugin, security

Setting up Install Process

Resolving Dependencies

--> Running transaction check

---> Package oracle-rdbms-server-11gR2-preinstall.x86_64 0:1.0-6.el6 will be installed

--> Processing Dependency: gcc-c++ for package: oracle-rdbms-server-11gR2-preinstall-


1.0-6.el6.x86_64

--> Processing Dependency: gcc for package: oracle-rdbms-server-11gR2-preinstall-1.0-


6.el6.x86_64
--> Processing Dependency: libaio-devel for package:
oracle-rdbms-server-11gR2-preinstall-1.0-6.el6.x86_64

--> Processing Dependency: libstdc++-devel for package:


oracle-rdbms-server-11gR2-preinstall-1.0-6.el6.x86_64

--> Processing Dependency: glibc-devel for package:


oracle-rdbms-server-11gR2-preinstall-1.0-6.el6.x86_64

--> Processing Dependency: compat-libstdc++-33 for package:


oracle-rdbms-server-11gR2-preinstall-1.0-6.el6.x86_64

--> Processing Dependency: ksh for package: oracle-rdbms-server-11gR2-preinstall-1.0-


6.el6.x86_64

--> Processing Dependency: compat-libcap1 for package:


oracle-rdbms-server-11gR2-preinstall-1.0-6.el6.x86_64

--> Running transaction check

---> Package compat-libcap1.x86_64 0:1.10-1 will be installed

---> Package compat-libstdc++-33.x86_64 0:3.2.3-69.el6 will be installed

---> Package gcc.x86_64 0:4.4.6-4.el6 will be installed

--> Processing Dependency: cpp = 4.4.6-4.el6 for package: gcc-4.4.6-4.el6.x86_64

--> Processing Dependency: cloog-ppl >= 0.15 for package: gcc-4.4.6-4.el6.x86_64

---> Package gcc-c++.x86_64 0:4.4.6-4.el6 will be installed

--> Processing Dependency: libmpfr.so.1()(64bit) for package: gcc-c++-4.4.6-


4.el6.x86_64

---> Package glibc-devel.x86_64 0:2.12-1.80.el6_3.4 will be installed

--> Processing Dependency: glibc-headers = 2.12-1.80.el6_3.4 for package:


glibc-devel-2.12-1.80.el6_3.4.x86_64

--> Processing Dependency: glibc-headers for package: glibc-devel-2.12-


1.80.el6_3.4.x86_64

---> Package ksh.x86_64 0:20100621-16.el6 will be installed

---> Package libaio-devel.x86_64 0:0.3.107-10.el6 will be installed

---> Package libstdc++-devel.x86_64 0:4.4.6-4.el6 will be installed

--> Running transaction check

---> Package cloog-ppl.x86_64 0:0.15.7-1.2.el6 will be installed

--> Processing Dependency: libppl_c.so.2()(64bit) for package: cloog-ppl-0.15.7-


1.2.el6.x86_64

--> Processing Dependency: libppl.so.7()(64bit) for package: cloog-ppl-0.15.7-


1.2.el6.x86_64

---> Package cpp.x86_64 0:4.4.6-4.el6 will be installed


---> Package glibc-headers.x86_64 0:2.12-1.80.el6_3.4 will be installed

--> Processing Dependency: kernel-headers >= 2.2.1 for package:


glibc-headers-2.12-1.80.el6_3.4.x86_64

--> Processing Dependency: kernel-headers for package: glibc-headers-2.12-


1.80.el6_3.4.x86_64

---> Package mpfr.x86_64 0:2.4.1-6.el6 will be installed

--> Running transaction check

---> Package kernel-uek-headers.x86_64 0:2.6.32-300.32.1.el6uek will be installed

---> Package ppl.x86_64 0:0.10.2-11.el6 will be installed

--> Finished Dependency Resolution

Dependencies Resolved

================================================================================

Package Arch Version Repository Size

================================================================================

Installing:

oracle-rdbms-server-11gR2-preinstall

x86_64 1.0-6.el6 ol6_latest 15 k

Installing for dependencies:

cloog-ppl x86_64 0.15.7-1.2.el6 ol6_latest 93 k

compat-libcap1 x86_64 1.10-1 ol6_latest 17 k

compat-libstdc++-33 x86_64 3.2.3-69.el6 ol6_latest 183 k

cpp x86_64 4.4.6-4.el6 ol6_latest 3.7 M

gcc x86_64 4.4.6-4.el6 ol6_latest 10 M

gcc-c++ x86_64 4.4.6-4.el6 ol6_latest 4.7 M

glibc-devel x86_64 2.12-1.80.el6_3.4 ol6_latest 970 k

glibc-headers x86_64 2.12-1.80.el6_3.4 ol6_latest 600 k

kernel-uek-headers x86_64 2.6.32-300.32.1.el6uek ol6_latest 713 k

ksh x86_64 20100621-16.el6 ol6_latest 684 k

libaio-devel x86_64 0.3.107-10.el6 ol6_latest 13 k


libstdc++-devel x86_64 4.4.6-4.el6 ol6_latest 1.5 M

mpfr x86_64 2.4.1-6.el6 ol6_latest 156 k

ppl x86_64 0.10.2-11.el6 ol6_latest 1.3 M

Transaction Summary

================================================================================

Install 15 Package(s)

Total download size: 25 M

Installed size: 61 M

Is this ok [y/N]: Downloading Packages:

--------------------------------------------------------------------------------

Total 710 kB/s | 25 MB 00:35

Running rpm_check_debug

Running Transaction Test

Transaction Test Succeeded

Running Transaction

Installing : mpfr-2.4.1-6.el6.x86_64 1/15

Installing : libstdc++-devel-4.4.6-4.el6.x86_64 2/15

Installing : cpp-4.4.6-4.el6.x86_64 3/15

Installing : ppl-0.10.2-11.el6.x86_64 4/15

Installing : cloog-ppl-0.15.7-1.2.el6.x86_64 5/15

Installing : kernel-uek-headers-2.6.32-300.32.1.el6uek.x86_64 6/15

Installing : glibc-headers-2.12-1.80.el6_3.4.x86_64 7/15

Installing : glibc-devel-2.12-1.80.el6_3.4.x86_64 8/15

Installing : gcc-4.4.6-4.el6.x86_64 9/15

Installing : gcc-c++-4.4.6-4.el6.x86_64 10/15

Installing : compat-libstdc++-33-3.2.3-69.el6.x86_64 11/15

Installing : libaio-devel-0.3.107-10.el6.x86_64 12/15


Installing : ksh-20100621-16.el6.x86_64 13/15

Installing : compat-libcap1-1.10-1.x86_64 14/15

Installing : oracle-rdbms-server-11gR2-preinstall-1.0-6.el6.x86_64 15/15

Verifying : gcc-4.4.6-4.el6.x86_64 1/15

Verifying : compat-libcap1-1.10-1.x86_64 2/15

Verifying : ksh-20100621-16.el6.x86_64 3/15

Verifying : glibc-devel-2.12-1.80.el6_3.4.x86_64 4/15

Verifying : libaio-devel-0.3.107-10.el6.x86_64 5/15

Verifying : oracle-rdbms-server-11gR2-preinstall-1.0-6.el6.x86_64 6/15

Verifying : gcc-c++-4.4.6-4.el6.x86_64 7/15

Verifying : glibc-headers-2.12-1.80.el6_3.4.x86_64 8/15

Verifying : libstdc++-devel-4.4.6-4.el6.x86_64 9/15

Verifying : compat-libstdc++-33-3.2.3-69.el6.x86_64 10/15

Verifying : mpfr-2.4.1-6.el6.x86_64 11/15

Verifying : kernel-uek-headers-2.6.32-300.32.1.el6uek.x86_64 12/15

Verifying : cpp-4.4.6-4.el6.x86_64 13/15

Verifying : ppl-0.10.2-11.el6.x86_64 14/15

Verifying : cloog-ppl-0.15.7-1.2.el6.x86_64 15/15

Installed:

oracle-rdbms-server-11gR2-preinstall.x86_64 0:1.0-6.el6

Dependency Installed:

cloog-ppl.x86_64 0:0.15.7-1.2.el6

compat-libcap1.x86_64 0:1.10-1

compat-libstdc++-33.x86_64 0:3.2.3-69.el6

cpp.x86_64 0:4.4.6-4.el6

gcc.x86_64 0:4.4.6-4.el6

gcc-c++.x86_64 0:4.4.6-4.el6
glibc-devel.x86_64 0:2.12-1.80.el6_3.4

glibc-headers.x86_64 0:2.12-1.80.el6_3.4

kernel-uek-headers.x86_64 0:2.6.32-300.32.1.el6uek

ksh.x86_64 0:20100621-16.el6

libaio-devel.x86_64 0:0.3.107-10.el6

libstdc++-devel.x86_64 0:4.4.6-4.el6

mpfr.x86_64 0:2.4.1-6.el6

ppl.x86_64 0:0.10.2-11.el6

Complete!

Listing 1: Installing the oracle-rdbms-server-11gR2-preinstall RPM

The yum installation logs messages about kernel changes in the file /var/log/oracle-rdbms-
server-11gR2-preinstall/results/orakernel.log, and it makes backups of current system
settings in the directory /var/log/oracle-rdbms-server-11gR2-preinstall/backup.

9. At this point, the system is ready for the installation of Oracle Database. For example, to install Oracle Database 11g Release 2,
follow the directions in Chapter 4, "Installing Oracle Database," of the Database Installation Guide for Linux."

Here are the steps I followed while installing Oracle Database 11g Release 2 in my test
environment. Make sure you review all documentation and follow recommended best practices
before installing into your production environment.

Note: Please note that the installer in earlier releases of 11g Release 2 (11.2.0.1 and 11.2.0.2)
will show "missing package" failures; e.g. for the pdksh package. These can safely be ignored,
the ksh package (which is the successor of pdksh) has already been installed by the preinstall
RPM. This bug was fixed in version 11.2.0.3 of the installer.

The Oracle Universal Installer performs a number of checks, verifying that the necessary OS
packages and versions are installed. In addition, it checks kernel parameters set by the oracle-
rdbms-server-11gR2-preinstall installation. During the kernel settings check, the installer might
flag a few settings as "failed," and you should investigate these failures. In some cases, you still
might be able to continue with the database installation. If you check kernel settings in
/etc/sysctl.conf, you'll see that oracle-rdbms-server-11gR2-preinstall has modified and
added the necessary settings to ensure the minimum requirements are met, as defined in section
2.10.1, "Displaying and Changing Kernel Parameter Values," in Chapter 2, "Oracle Database
Preinstallation Requirements," of the Oracle Database Installation Guide 11g Release2 (11.2) for
Linux. Below is the list of requirements:

fs.aio-max-nr = 1048576
fs.file-max = 6815744

kernel.shmall = 2097152

kernel.shmmax = 4294967295

kernel.shmmni = 4096

kernel.sem = 250 32000 100 128

net.ipv4.ip_local_port_range = 9000 65500

net.core.rmem_default = 262144

net.core.rmem_max = 4194304

net.core.wmem_default = 262144

net.core.wmem_max = 1048576

If necessary, you can (as root) edit the file /etc/sysctl.conf to specify a setting manually, for
example:

# vi /etc/sysctl.conf

# /sbin/sysctl -p

The Oracle Universal Installer performs additional checks, such as verifying the glibc version,
sufficient disk space, environmental variable and path settings, and sufficient physical memory
and swap space. Generally, installing oracle-rdbms-server-11gR2-preinstall takes care of the
prerequisites so that you can proceed directly with installing the database.

a. As root, create a parent directory in a file system that has sufficient space to be the target location for the downloaded
files:

b.
c. # mkdir /home/OraDB11g
d.
e. # cd /home/OraDB11g
f.

The amount of disk space needed in the file system varies according to the specific
installation type, but roughly twice the size of the zip archives, or 5 GB, is enough to house
the software and data files.

g. Into this target directory, download the installation media files from the Oracle Database Software Downloads page on
Oracle Technology Network.
h. Extract the files:

i.
j. # unzip linux.x64_11gR2_database_1of2.zip
k.
l. # unzip linux.x64_11gR2_database_2of2.zip
m.
n. Log in as the user oracle. Change directory to the database directory and enter the following command to run the
Oracle Universal Installer:

o.
p. $ cd /home/OraDB11g/database
q.
r. $ ./runInstaller
s.
Final Thoughts

Installing the oracle-rdbms-server-11gR2-preinstall RPM can save time when installing Oracle
Database 11g on Oracle Linux. The RPM addresses most Oracle Database installation prerequisites
and greatly simplifies the installation process.

See Also

Here are the resources referenced earlier in this document:

 Oracle Unbreakable Linux Network: https://linux.oracle.com


 Oracle public yum repository: http://public-yum.oracle.com/
 Oracle software delivery cloud (requires registration or login): https://edelivery.oracle.com/linux
 Chapter 4, "Installing Oracle Database," of the Database Installation Guide for Linux:
http://docs.oracle.com/cd/E11882_01/install.112/e24321/inst_task.htm#BABBBHJH
 Oracle Database Software Downloads page on Oracle Technology Network:
http://www.oracle.com/technetwork/database/enterprise-edition/downloads/index.html

And here are some additional resources from the Oracle Database Documentation Library
(http://www.oracle.com/pls/db112/homepage). Relevant subsections from the Oracle Database
Installation Guide 11g Release 2 (11.2) for Linux
(http://download.oracle.com/docs/cd/E11882_01/install.112/e16763/toc.htm) with currently valid URLs
are as follows:

 "About the Oracle RDBMS Pre-Install and Oracle Validated RPMs" from Chapter 1, "Overview of Oracle Database Installation":
http://download.oracle.com/docs/cd/E11882_01/install.112/e16763/install_overview.htm#BABDBHCJ
 Chapter 2, "Oracle Database Preinstallation Requirements":
http://download.oracle.com/docs/cd/E11882_01/install.112/e16763/pre_install.htm#BABFDGHJ
 "Downloading Oracle Software" from Chapter 4, "Installing Oracle Database," which describes how to download installation files
from the Oracle Technology Network Website: http://docs.oracle.com/cd/E11882_01/install.112/e16763/inst_task.htm#autoId6

Also see the blog entry "Oracle RDBMS Server 11gR2 Pre-Install RPM for Oracle Linux 6 has been
released": https://blogs.oracle.com/linux/entry/oracle_rdbms_server_11gr2_pre
DUMPS
NIC Bonding in RHEL6
Release
RHEL 6

Problem
Need to configure NIC channel bonding in RHEL 6

Solution
Red Hat Enterprise Linux allows administrators to bind multiple network interfaces together into a single channel using
the bonding kernel module and a special network interface called a channel bonding interface. Channel bonding enables two
or more network interfaces to act as one, simultaneously increasing the bandwidth and providing redundancy. The behavior
of the bonded interfaces depends upon the mode, either hot standby or load balancing service.

Steps for configuring bonding


In this document we are configuring bond0 with interfaces eth0 and eth1

Step 1- Load Kernel module


For a channel bonding interface to be valid, the kernel module must be loaded. To ensure that the module is loaded when
the channel bonding interface is brought up, create a new file as root named <bonding>.conf in the /etc/modprobe.d/
directory. Note that we can name this file anything but it should with ends with a .conf extension. Insert the following line
in this new file alias bond<N> bonding
Replace <N> with the interface number, such as 0. If we want to configure configuring more than on bonding interface,

For each configured channel bonding interface, there must be a corresponding entry in
/etc/modprobe.d/<bonding>.conf file
In this example we are configuring bond0 and file name is bonding.conf
[root@praji2 modprobe.d]# cat /etc/modprobe.d/bonding.conf
alias bond0 bonding

Step2- create channel bonding interface


We need to create a channel bonding interface configuration file on /etc/sysconfig/network-scripts/ directory
called ifcfg-bond<N> , replacing <N> with the number for the interface, such as 0 and specify the bonding parameters on
the file. Here we are creating ifcfg-bond0 file with following contents
[root@praji2 network-scripts]# cat ifcfg-bond0
DEVICE=bond0
IPADDR=172.16.1.207
NETMASK=255.255.255.0
ONBOOT=yes
BOOTPROTO=none
USERCTL=no
BONDING_OPTS="mode=0 miimon=1000"

Step 3- Configure Network interfaces


After the channel bonding interface is created, the network interfaces to be bound together must be configured by adding
the MASTER= and SLAVE= directives to their configuration files. The configuration files for each of the channel-bonded
interfaces can be nearly identical. For example, if two Ethernet interfaces are being channel bonded,
both eth0 and eth1 may look like the following example
Interface eth0 configuration
[root@praji2 network-scripts]# cat ifcfg-eth0
DEVICE=eth0
ONBOOT=yes
MASTER=bond0
SLAVE=yes
BOOTPROTO=none
USERCTL=no
TYPE=Ethernet

Interface eth1 configuration


[root@praji2 network-scripts]# cat ifcfg-eth1
DEVICE=eth1
ONBOOT=yes
MASTER=bond0
SLAVE=yes
BOOTPROTO=none
TYPE=Ethernet
USERCTL=no
After configuring the interfaces we have to bring up the bond by using command
[root@praji2 network-scripts]# ifconfig bond0 up
If the bonding is correctly configured we can view the configuration using ifconfig command
[root@praji2 network-scripts]# ifconfig
bond0 Link encap:Ethernet HWaddr 00:0C:29:69:31:C4
inet addr:172.16.1.207 Bcast:172.16.1.255 Mask:255.255.255.0
inet6 addr: fe80::20c:29ff:fe69:31c4/64 Scope:Link
UP BROADCAST RUNNING MASTER MULTICAST MTU:1500 Metric:1
RX packets:19676 errors:0 dropped:0 overruns:0 frame:0
TX packets:342 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:1623240 (1.5 MiB) TX bytes:42250 (41.2 KiB)

eth0 Link encap:Ethernet HWaddr 00:0C:29:69:31:C4


UP BROADCAST RUNNING SLAVE MULTICAST MTU:1500 Metric:1
RX packets:10057 errors:0 dropped:0 overruns:0 frame:0
TX packets:171 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:832257 (812.7 KiB) TX bytes:22751 (22.2 KiB)
Interrupt:19 Base address:0x2000

eth1 Link encap:Ethernet HWaddr 00:0C:29:69:31:C4


UP BROADCAST RUNNING SLAVE MULTICAST MTU:1500 Metric:1
RX packets:9620 errors:0 dropped:0 overruns:0 frame:0
TX packets:173 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:791043 (772.5 KiB) TX bytes:20207 (19.7 KiB)
Interrupt:19 Base address:0x2080

lo Link encap:Local Loopback


inet addr:127.0.0.1 Mask:255.0.0.0
inet6 addr: ::1/128 Scope:Host
UP LOOPBACK RUNNING MTU:16436 Metric:1
RX packets:2 errors:0 dropped:0 overruns:0 frame:0
TX packets:2 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:104 (104.0 b) TX bytes:104 (104.0 b)

To view all existing bonds we can run following command, it will list bond0
[root@praji2 network-scripts]# cat /sys/class/net/bonding_masters
bond0
To view the existing mode of bonding we can use following command
[root@praji2 network-scripts]# cat /sys/class/net/bond0/bonding/mode
balance-rr 0
For verifying bonding , we can use following command. It will list bonding details
[root@praji2 network-scripts]# cat /proc/net/bonding/bond0
Ethernet Channel Bonding Driver: v3.5.0 (November 4, 2008)

Bonding Mode: load balancing (round-robin)


MII Status: up
MII Polling Interval (ms): 1000
Up Delay (ms): 0
Down Delay (ms): 0

Slave Interface: eth0


MII Status: up
Link Failure Count: 0
Permanent HW addr: 00:0c:29:69:31:c4

Slave Interface: eth1


MII Status: up
Link Failure Count: 0
Permanent HW addr: 00:0c:29:69:31:ce

bonding modes
Several policies are available in bonding, this mode can be set using directive mode=<value>
The <value> can be one of:
balance-rr or 0 — Sets a round-robin policy for fault tolerance and load balancing. Transmissions are received and sent
out sequentially on each bonded slave interface beginning with the first one available.
active-backup or 1 — Sets an active-backup policy for fault tolerance. Transmissions are received and sent out via the
first available bonded slave interface. Another bonded slave interface is only used if the active bonded slave interface fails.
balance-xor or 2 — Sets an XOR (exclusive-or) policy for fault tolerance and load balancing. Using this method, the
interface matches up the incoming request's MAC address with the MAC address for one of the slave NICs. Once this link is
established, transmissions are sent out sequentially beginning with the first available interface.
broadcast or 3 — Sets a broadcast policy for fault tolerance. All transmissions are sent on all slave interfaces.
802.3ad or 4 — Sets an IEEE 802.3ad dynamic link aggregation policy. Creates aggregation groups that share the same
speed and duplex settings. Transmits and receives on all slaves in the active aggregator. Requires a switch that is 802.3ad
compliant.
balance-tlb or 5 — Sets a Transmit Load Balancing (TLB) policy for fault tolerance and load balancing. The outgoing
traffic is distributed according to the current load on each slave interface. Incoming traffic is received by the current slave. If
the receiving slave fails, another slave takes over the MAC address of the failed slave.
balance-alb or 6 — Sets an Active Load Balancing (ALB) policy for fault tolerance and load balancing. Includes transmit
and receive load balancing for IPV4 traffic. Receive load balancing is achieved through ARP

************************************************
Setting the Partition

dd if=/dev/zero of=PhysicalVolume bs=512 count=1

Initializing Physical Volumes / Creating Physical Volumes

pvcreate /dev/sdd1 /dev/sde1 /dev/sdf1

Displaying Physical Volumes


pvs,
pvdisplay,
pvscan

Scanning for Block Devices


# lvmdiskscan

Preventing / Enabling Allocation on a Physical Volume


pvchange -x n /dev/sdk1

pvchange -x y /dev/sdk1 => enable

# lvcreate -L 50MB new_vg

# lvcreate -v -L 50MB new_vg

# lvcreate -vvvv -L 50MB new_vg

Resizing a Physical Volume


Pvresize

Removing Physical Volumes

# pvremove /dev/ram15
Labels on physical volume "/dev/ram15" successfully wiped
Volume Group Administration

Creating Volume Groups


vgcreate vg1 /dev/sdd1 /dev/sde1

4MB extents = default

vgcreate –s => extends size

Adding Physical Volumes to a Volume Group


The following command adds the physical volume /dev/sdf1 to the volume group vg1.

vgextend vg1 /dev/sdf1

vgdisplay.

Removing Physical Volumes from a Volume Group


# vgreduce my_volume_group /dev/hda1

Activating and Deactivating Volume Groups

vgchange -a n my_volume_group
(Vgchange used for changing the parameters)

Removing Volume Groups


To remove a volume group that contains no logical volumes, use the vgremove command.
# vgremove officevg
Volume group "officevg" successfully removed

Backing Up Volume Group Metadata


Metadata backups and archives are automatically created on every volume group and logical
volume configuration change unless disabled in the lvm.conf file.
By default, the metadata
backup is stored in the /etc/lvm/backup file and the metadata archives are stored in the
/etc/lvm/archives file.
You can manually back up the metadata to the /etc/lvm/backup file
with the vgcfgbackup command.
The vgcfrestore command restores the metadata of a volume group from the archive to all the
physical volumes in the volume groups.

Renaming a Volume Group


vgrename /dev/vg02 /dev/my_volume_group
vgrename vg02 my_volume_group

3.13. Moving a Volume Group to Another System


You can move an entire LVM volume group to another system. It is recommended that you use
the vgexport and vgimport commands when you do this.
The vgexport command makes an inactive volume group inaccessible to the system, which
allows you to detach its physical volumes. The vgimport command makes a volume group
accessible to a machine again after the vgexport command has made it inactive.
To move a volume group form one system to another, perform the following steps:
1. Make sure that no users are accessing files on the active volumes in the volume group, then
unmount the logical volumes.
2. Use the -a n argument of the vgchange command to mark the volume group as inactive,
which prevents any further activity on the volume group.
3. Use the vgexport command to export the volume group. This prevents it from being
accessed by the system from which you are removing it.
After you export the volume group, the physical volume will show up as being in an exported
volume group when you execute the pvscan command, as in the following example.
[root@tng3-1]# pvscan
PV /dev/sda1 is in exported VG myvg [17.15 GB / 7.15 GB free]
PV /dev/sdc1 is in exported VG myvg [17.15 GB / 15.15 GB free]
PV /dev/sdd1 is in exported VG myvg [17.15 GB / 15.15 GB free]
...
When the system is next shut down, you can unplug the disks that constitute the volume
group and connect them to the new system.
4. When the disks are plugged into the new system, use the vgimport command to import the
volume group, making it accessible to the new system.
5. Activate the volume group with the -a y argument of the vgchange command.
6. Mount the file system to make it available for use.

Recreating a Volume Group Directory


To recreate a volume group directory and logical volume special files, use the vgmknodes
command. This command checks the LVM2 special files in the /dev directory that are needed
for active logical volumes. It creates any special files that are missing removes unused ones.
You can incorporate the vgmknodes command into the vgscan command by specifying the
--mknodes argument to the command.

Creating Logical Volumes


lvcreate

Creating Linear Volumes


lvcreate -L 10G vg1

lvcreate -L1500 -n testlv testvg


lvcreate -L 50G -n gfslv vg0
.
lvcreate -l 60%VG -n mylv testvg

lvcreate -L 1500 -ntestlv testvg /dev/sdg1


You can specify which extents of a physical volume are to be used for a logical volume

creates a linear logical volume out of extents 0 through 25 of physical volume


/dev/sda1 and extents 50 through 125 of physical volume.
lvcreate -l 100 -n testlv testvg /dev/sda1:0-25 /dev/sdb1:50-125

The following example creates a linear logical volume out of extents 0 through 25 of physical
volume /dev/sda1 and then continues laying out the logical volume at extent 100.
lvcreate -l 100 -n testlv testvg /dev/sda1:0-25:100-

Creating Striped Volumes


The following command creates a striped logical volume across 2 physical volumes with a stride
of 64kB.
lvcreate -L 50G -i2 -I64 -n gfslv vg0

Creating Mirrored Volumes


number of copies of the data => -m argument of the lvcreate command. Specifying -m1 creates one
mirror,
-m2 creates two mirrors
s carved out of volume group vg0:
lvcreate -L 50G -m1 -n gfslv vg0

lvcreate -L 500M -m1 -n mirrorlv vg0 /dev/sda1 /dev/sdb1 /dev/sdc1

Changing Mirrored Volume Configuration


lvconvert -m1 vg00/lvol1
The following command converts the mirrored logical volume vg00/lvol1 to a linear logical
volume, removing the mirror leg.
lvconvert -m0 vg00/lvol1

Creating Logical Volumes


Resizing Logical Volumes

lvreduce -l -3 vg00/lvol1

Renaming Logical Volumes


lvrename /dev/vg02/lvold /dev/vg02/lvnew
lvrename vg02 lvold lvnew

Removing Logical Volumes


[root@tng3-1 lvm]# lvremove /dev/testvg/testlv
Growing Logical Volumes
.
# lvextend -L12G /dev/myvg/homevol

# lvextend -L+1G /dev/myvg/homevol

[root@tng3-1 ~]# lvextend -l +100%FREE /dev/myvg/testlv

# lvextend vg/stripe1 -L 406G

# vgextend vg /dev/sdd1

# lvextend vg/stripe1 -L 542G

# lvextend vg/stripe1 -L 406G

LVM Administration with CLI Commands


more required
# lvextend -i1 -l+100%FREE vg/stripe1
4.10. Shrinking Logical Volumes
lvreduce -l -3 vg00/lvol1

Shrinking Logical Volumes

Splitting a Volume Group


# vgsplit bigvg smallvg /dev/ram15
Volume group "smallvg" successfully split from "bigvg"
Combining Volume Groups
vgmerge -v databases my_vg

Scanning for Block Devices :

# lvmdiskscan
PVSCAN / PVDISPLAY

Preventing Allocation on a Physical Volume

pvchange -x n /dev/sda1

pvchange –x y /dev/sda1

#PV CREATE /dev/sda1 /dev/sad2

#VGCREATE VGNAME /dev/sda1 /dev/sda2

#LVCREATE -L 5G –n LVNAME VGNAME

-l (for PE size)

You might also like