Red Hat Linux Enterprise 5
-
Upload
sreekaanth-ganesan -
Category
Documents
-
view
222 -
download
3
description
Transcript of Red Hat Linux Enterprise 5
Red Hat Linux Enterprise 5
Trainer - Mohammed Usman Sharieff
Unix - AT & T, Bell labs
HP Unix - HPAIX Unix - IBM
Solaris 10 – SUNFree or open source code -LINUX
Flavours of Linux
SuSe Caldera
Mandrake Fedora
RedHat - most popular
OS
Kernel – Core of the operating systemInteracts with hardware
Shell - bash shell ; command mode user interface
X windows system - GUI
Run levels: different modes in which the OS can be booted
Init 0 shutdownInit 1 single user modeInit 2 multi user Init 3 multi user with networkingInit 4 un usedInit 5 multi user with networking
and GUI ( X windows system)Init 6 restart
Understanding devices in Linux
/dev/hda h for ide device/dev/sda s for sata device
hda – a for primary masterhdb - b for primary slavehdc - c for secondary msterhdd - d for secondary slave
Numbering of the partitions
Primary /dev/hda1/dev/hda2/dev/hda3
Extended /dev/hda4
Logical /dev/hda5/dev/hda6/dev/hda7and so on….
Partitions required to install the RedHat Linux Enterprise 5
/boot 100MB /dev/hda1/ 5GB or greater /dev/hda2/swap 2 times of RAM /dev/hda3
/home home directory for users /dev/hda5
Root refers to……
/ slash or root directory that contains the OS
Root also refers to root user (administrator)
$ normal user prompt# root user prompt
Basic commands
ls ls-l date time clear man cd pwd
cp mv mkdir rm rmdir rm –r
vi filename touch filename gedit filename cat filename
useradd userdel passwd username head filename
more filename less filename ls-l>abc tail filename
su username su (for root) who whoami
hostname df –h df -T fdisk -l ifconfig -a
Working with HDD
1. fdisk – for partitioningfdisk /dev/hda
2. mkfs – for formatingcreating the file system (ext2 or ext3)
mkfs /dev/hda5
3. mounting : to make it accessible under the /mount /dev/hda5 /apps
Any partition or drive that needs to be accessibleHas to be mounted under the / . So create a folder under /For this partition or drive and mount it under that folder.
/etc directorycontains configuration files
/etc/inittab to change the run levels during boot
/etc/fstab for mounting partitions during boot
HDD partitionsFdisk /dev/hdaMkfs /dev/hda5 (ext 2)
Mkfs.ext3 /dev/hda5Mkfs –t ext3 /dev/hda5
e2label /dev/hda5 /dataMkdir /dataMount /dev/hda5 /data
Vi /etc/fstab
LABEL=/data /data ext3 defaults 1 2or /dev/hda5 /data ext3 defaults 1 2
Blkid Blkid /dev/hda5
Boot ProcessAfter Power on , POST , CMOS Setup, boot seq – HDD, MBR;GRUB …………………./boot contains boot loader, kernel and init
Boot loader – GRUBKernel and driversProcess – first process is Init /etc/rc.d/rc.sysinit
/etc/inittab /etc/rc.d/rc5.d/files K for kill scripts and s for start scripts
all files are linked to /init.d
Volumesfdisk –lfdisk /dev/sdanst cylend cyl: 100MBtpart no 10code; 8ewreboot
fdisk –l create 11th partition
fdisk /dev/sdanst cylend cyl: 100MBwreboot
pvcreate /dev/sda11 /dev/sda12 /dev/sda13pvdisplayvgcreate pool1 dev/sda11 /dev/sda12 /dev/sda13vgdisplaylvcreate pool1 –L 150 -n datalvcreate pool1 –L 150 -n appslvdisplay
we need to format, mount and put entry in vi/etc/fstabdf -h
pvcreate /dev/sda6 /dev/sda7 /dev/sda8pvdisplay
vgcreate pool1 /dev/sda6 /dev/sda7 /dev/sda8vgdisplay
lvcreate pool1 –L 152 -n datalvcreate pool1 –L 148 -n appslvdisplay
mkfs –t ext3 /dev/pool1/datamkfs –t ext3 /dev/pool1/apps
mkdir /datamkdir /apps
Vi /etc/fstab/dev/pool1/data /data ext3 defaults 1 2/dev/pool1/apps /apps ext3 defaults 1 2
Create partitionConvert to physical volumevgextend pool1 /dev/sda15
Lvextend –L 1000 /dev/pool1/vol1
Previously vol1 was 600We have added 400
So to extend we have to giv e total 1000Then umount
Format and mount again
Swap partitionfdisk –lfdisk /dev/sdanStart cylEnd cyltPart noCode : 82w
partprobeor reboot
mkswap /dev/sda8swapon /dev/sda8vi /etc/fstab/dev/sda8 swap swap Defaults 0 0
swapon –sfree
Users and groupsUseradd userdel
groupadd groupdel
Usermod -G groupname username(adding users to the group)
Id username
File permissions : chmod
d rwx rwx rwxFile/dir user group others
r w x4 2 1
chmod 777 filename ( 7 for user, group, others) chmod 750 filename (rwx for user, rx for group
and none for others)
permissions
# chown username filename# chown : groupname filename# chown username : groupname filename
#chgrp groupname folder
Umask - 0022
First mention umask then create the files.
If Umask is 022 folder perm is 755
if umask is 022 file perm should be 755since no execute (-111) the perm is 644 for files
execute for folder means to list (ls)
Create directories, users and groups, give passwords to usersadd users to the groupgive permission for each folder to each groupdeny others access to the folders
mkdir sales mkdir itUseradd sales1 useradd it1Passwd sales1 passwd it1Groupadd sales groupadd it Usermod –G sales sales1 Usermod –G it it1Chgrp sales /data/sales chgrp it /data/itChmod 770 /data/sales chmod 770 /data/itChmod g+s /data/sales chmod g+s /data/it
rpm rpm –ivh package rpm –U package… rpm - F package….
rpm –e (uninstall) (without .rpm)
yum install package (online) Yum upgrade package
Rpm –qa rpm –q sambaFrom CD to /usr/src/redhat
# bzip2 filename # gzip filename# bzip2 –d filename #gzip –d filename
(-d decompress)
mv a .a (creating hidden file)ls –all (listing hidden files also)
ln (copy and link)
mkdir /data1mkdir /data2Cd data1, vi exln ex /data2/ex
Networkingifconfig –a Unix OSIpconfig/all MS WindowsNetconfig Novell netware
Ifconfig eth0 up
ifconfiig eth0 10.0.0.10Ifconfig eth0 downservice network restart
vi /etc/sysconfig/network-scripts/ifcfg-eth0Change the ip esc :wq
service network restart
Services Service network restartService network stopService network startService iptables status
Service autofs status/etc/sysconfig/autofs
chkconfig autofs on (will tick the service in the tool system-config-services)
Nis – authentication (similar to ADS of MS or NDS of novell
nfs – sharing (between unix )
samba – (sharing between unix and MS pcs)
apache – web server (similar to IIS of MS)
bind – dns – named server
dhcp - (automatic configuration of ip, dg, dns)
ftp (file upload and download)
telnet (remote access)
nfs configuration on the Serverrpm –ivh nfs…..rpm
service nfs start
vi /etc/exports/data 10.0.0.0/255.0.0.0(rw,sync,no_root_squash)
exportfs –rv
service portmap restart service nfs restart
Chkconfig nfs on
Client configuration for nfs
vi /etc/fstab ipaddress : /data /data nfs defaults 0 0computername : /data /data nfs defaults 0 0
Example: srv1:/home /home nfs defaults 0 0
Vi /etc/hosts (if servername is used)ip computername
Basic commandsTAR tar cvf test.tar test
tar xvf test.tar
c-create x – extract f - file
Attributes : lsattr chattr
chattr +i filename (cannot delete or rename)
i-immutable
ls –R (list sub directories and files – tree )rm -r (remove all subdirec and files )rmdir for empty directories
cat /proc/cpuinfo
Piping - grepFind Locate
Grep name /etc/passwdEgrep
ps –e | moreEgrep : /etc/passwd |more
ls –l | more
Troubleshooting
Mount –o remount,rw /