Redhat 5
Redhat 5
saravanan
CHAPTER - 1
LINUX (LIH-NUCKS)
Official OS Free OS
(Red Hat Enterprises Linux) ( Red Hat 9, Fedora)
INTRODUCTION TO LINUX
• Linux is quite possibly the most important free
software achievement.
• It has been developed into an operating system
for business, education and personal
productivity.
• Linux (pronounced with a short I, as in LIH-
nucks) is a UNIX operating system clone.
History of Linux
• UNIX is one of the most popular operating systems
worldwide because of its large support base and
distribution.
• It was originally developed at AT&T as a
multitasking operating system for minicomputers and
mainframes in the 1970’s, but has since grown to
become one of the most widely used operating
systems.
• Linux is a free version of UNIX developed by LINUS
TORVALDS at the university of Helsinki in Finland.
About Linux
• Linus Torvalds originally developed Linux as
a hobby project.
• Minix, a small UNIX system developed by
Andy Tanenbaum, inspired it
• The Linux kernel uses no code from AT&T or
any other proprietary source.
• On October 5, 1991, Linus announced the first
“official” version of Linux ,which was version
0.02.
Famous Linux Distributions
• Red Hat Linux
• SuSe Linux
• Caldera Linux
• Mandrake Linux
• Open Linux
• Aryabhat Linux
Why Linux?
• Linux is a UNIX like operating systems
• Multi-user, Multi-tasking and Multi Processor
Support
• There are no royalty or license fees
“ A Linux Distribution has thousands of
dollars worth of software for no cost or a
couple of dollars if purchased on CD/DVD “
• Software Development Supports
• Linux runs on nearly any CPU
• Linux works very well as a personal computer
UNIX for the desktop
• Linux works well for server operations
• X-Window system (An excellent window
system called X)
Hardware Requirement
CPU:
Minimum : Pentium-class
Recommended : 200 Mhz Pentium-class or better
Hard Disk Space:
Minimum : 650 MB
Recommended : 2.5 GB
Full Installation : 4.5 GB
* Additional Space will be required for file storage.
Memory:
Minimum for text-mode : 64MB
Minimum for graphical : 128MB
Recommended for graphical: 192MB
CHAPTER - 2
Getting Started
Kernel
hardware devices
Fig - I
Fig - II
• Hardware Devices :
The lower most layer is the hardware components
(i.e. physical components like your motherboard, hard disk
drive, floppy drive, memory, etc…)
• Kernel :
When your system is booted, the Linux kernel will
be loaded into the memory of your system and after that the
kernel will control the entire operating system.
• Shell :
Shell is an interpreter through which a user can
interact with kernel.
Shell is program or command.
An application program may be a image editor,
word processor, music player, Games, and etc…..
Basic Commands
• ls Listing the file and directory
syn: # ls <options> <Destination directory>
example: # ls –l
• man Help
example: # man ls
• pwd Present working directory
# pwd
1. Cat
2. Touch
3. Vi editor
4. Gedit
Cat Command
it’s used to one of the file creation and right now give some content.
• To Create a file
# cat >murali
welcome to
accel it academy
^D
• To add a Content
# cat >>murali
Vadapalani
^D
• To view the content in a file
# cat murali
welcome to
Accel it academy
Vadapalani
#
Touch Command
# touch murali
#
Gedit Command
• It’s file create and modify in X Windows
Terminal
#gedit
or
# gedit <filename>
# gedit murali
Vi editor
• This type of file create and modify in CUI
and GUI terminal mode.
• It’s a editing tool.
• We can worked on three modes
1. ESC mode
2. Insert mode
3. Command mode
Syntax : # vi <Filename>
Example : # vi Rambo
• Esc a – Curser move the next position switch to insert mode.
• Esc i – Curser move to the beginning of the line and switch to insert mode.
• Esc A – Curser move to the end of the line and switch to insert mode.
• Esc o – Insert the new line below the curser position and switch to insert mode.
• Esc O – Insert the new line above the curser position and switch to insert mode.
• Esc r – Replace the single character.
• Esc R – Replace the enter line after the curser position
• Esc s – Deleted current character and switch to insert mode.
• Esc S – Deleted the enter line
• Esc x – To delete a character.
Esc k
Esc h Esc l
Esc g
• Esc gg – Move the curser to beginning of the first line.
• Esc GG – Move the curser to the beginning of the lost line.
• Esc w – Move the curser to beginning of the next word.
• Esc d – Move the curser to the beginning of previous word.
• Esc dd – Delete the current line’s.
• Esc dw –delete the current word’s.
• Esc yy – Copy the current line.
• Esc yw – Copy the current word.
• Esc p – Paste the line and words.
• Esc u –Undo.
• Esc + Ctr + r – Redo.
• Esc : set nu – To display enter line with numbering.
• Esc : q – Quite without save file.
• Esc : q! – Force quite without save file.
• Esc : wq – To save and Quit.
• Esc : wq! – To force save and quit.
• rmdir - To remove the directory
• rm –r - To remove the directory
• rm - To remove the file.
• type cat - To find out the location of the command
• file murali - To view the type of file
• wc - To view the no, of lines (l) , no, of word (w), no, of characters (c)
in file
• mv - To move the file
• cp - To copy the file and directory
• head - 10 murali – To view the top 10 lines in a file
• tail – 10 murali - To view the bottom 10 lines in a file
• sort murali - To saw the order wise in a file ( numerical(-n) and reverse (-r)
• grep -To search for the string
• aspell –c murali – To check the correct content in a file
• hostname murali – To change the hostname in murali
• exit -To logout M/C
• logout - To logout M/C
• clear - To clear the screen
• who - who logged in to our system currently
• bc - Calculator
CHAPTER - 3
Installation of REDHAT Linux
“ Do Lab “
Better
CHAPTER - 4
The X-Window System
• The heart of Red Hat Linux is the kernel , for
many users, the face of the operating system is
the graphical environment provided by the X
Windows System, also called X.
“ Do Lab “
CHAPTER - 5
Linux Boot Process & Run
Level
• POST : (Power on self test )
If will test what are commanded connected to the mother board and
they are properly working or not.
• Boot Loader :
1. GRUB – Grant unified boot loader (default install in Linux)
2. LILO - Linux Loader
-/- - -/- - - /- - -
Types of the Files
• - Regular file
• d Directory
• b Block device
• l Linking files
• c Character files
Default permission in file and
directory
• File
- / r w -/r - - /r - -
• Directory
d / r w x /r – x /r – x
File permission can be assign two
ways
• Symbolic method.
- / r w - /r w - /r w –
Numeric or Absolute Method
• Permission can be assigned using numeric
word.
Examples
• Syntax :
#chmod <permission> <File or Directory >
# chmod U G O file or dir
• Example:
#chmod 742 Ramesh
d/ r w x / r - - /- w -
# chmod 312 murali
- / - w x /- - x / - w –
“ Do Practice”
Advance or Special Permission
• This file permission assign to a execute file.
( Directory)
Setuid = 4
Setgid = 2
Stickybit = 1
• To assign execute permission user, group, and
others means.
Setuid – Set user identify – s
Setgid – Set group identify – s
Stickybit – Other identify – t
• Can ‘t to assign execute permission user, group,
and others means.
Setuid – Set user identify – S
Setgid – Set group identify – S
Stickybit – Other identify – T
Examples
- / - - S or s /- - S or s /- - T or T
Identify
• Syntax :
#chmod <permission> <File or Directory >
# chmod ID U G O file or dir
To assign the user, group, and
others
• Example:
#chmod 5742 murali
d/ r w s / r - - /- w T
“ Do Practice”
File Compressing
• To compressing the files.
* gzip :
It’s Compressing Linux and Unix based files. It can compress up to 75%
of the current files. The Compressed file will be in “.gz” format.
Ex: Ex: “murali.gz”
1. To Compress the file:
• To deleting an user’s:
# userdel murali (to delete a without home directory)
# userdel –r murali (to delete a with home directory)
• To set password the user:
#passwd murali
New password : *****
Retype password: *****
• To set without password the user:
# passwd –d murali (-d means without password).
Group Administration in Terminal
• A group contain similar type of user as it members.
( Collection of users called as group)
• The Group Add :
Syntax : #groupadd [-g GID ] group name
Example : #groupadd –g 100 Linux-Admin
• The Group Modify:
Syntax : # groupmod [ -g new gid ] [ -n new name] group
name
Example : #groupmod –g 109 –n mail-Admin Linux-Admin
• The Delete a Group:
Example : #groupdel Linux-Admin
Graphical Mode (User & Group)
CHAPTER - 8
Disk Administration
Devices
• Devices are either block devices or character devices.
• A Character device is one from which you can read a sequence
of character. Example: Keyboard.
• A block device is one that stores data and offers access to all
parts equally, It’s also referred as random access devices.
Example : Hard disk.
• /dev/hda - IDE Hard disk – Primary Master.
• /dev/hdb - IDE Hard disk – Primary Slave.
• /dev/hdc - IDE Hard disk – Secondary Master.
• /dev/hdd - IDE Hard disk – Secondary Slave.
• /dev/sda - First SCSI Hard disk.
• /dev/sdb - Second SCSI Hard disk.
• /dev/fd0 - Floppy Disk Drive.
• /dev/cdrom - Cdrom Drive – Linked to corresponding hard disk
device file according to the configuration.
• /dev/hda1 - First partition in the primary master IDE hard disk
drive .
• /dev/hda2 - Second partition in the primary master IDE hard disk
drive .
• /dev/sda1 - First partition in the first SCSI hard disk drive.
• Mount - For accessing a block device you have to mount it in
the different devices. The location you are mounting
the device is called the mounting point.
# mount <device path> <mounting point>
# mount /dev/cdrom /root/murali
• Umount - Is used to unmount a mount file systems.
# umount /root/cdrom
• The /etc/mtab file :
The file contains the information about the currently
mounted file systems. This file will automatically updated when you are
mounting or unmounting partitions.
• The /etc/fstab file :
Is a text file which contain the information of the file
system. This file reads during the system startup and the file specified in it will
get mounted automatically.
• Creating New File systems :
After formatting a block device like floppy you have to make
file system on the floppy .
Syntax : # mkfs –t fstype device name
Example : #mkfs –t ext2 /dev/fd0
File system:
Ext2 --- Extended 2
Ext3 --- Extended 3
Disk partition Steps :
• To show the partition:
# fdisk –l
• To create a partition:
Example : Secondary IDE hard disk means ( /dev/hdb )
#fdisk /dev/hdb
command (m for help) : m
command (m for help) : n
command action
l logical (5 or over)
p Primary (1 – 4 )
press l
First Cylinder (400 – 2437, default 400) : 400
last cylinder or +size or +sizeM or +sizeK (400-2437, default 2437) : 500
command (m for help) : w
• Reboot your machine:
# reboot
• Create a file system:
Example : /dev/hdb8
# mkfs –t ext3 /dev/hdb8
• To mount the partition:
# mount /dev/hdb8 /murali
CHAPTER - 9
RPMS
1. at
2. cron
at :
To schedule a one-time job at specific time.
Syntax : # at HH:MM format
Example: # at 10:30 pm
at> power off
Ctrl + d
Cron :
Cron is a daemon that can be used to schedule the execution of recurring task
according to a combination of the time, day of the month, month, day of the
week, and week. “ /etc/crontab ”
( * means – Everyday)
1D IN NS murali.king.com
murali 1D IN A 10.0.0.9
www 1D IN CNAME
6. To config the zone files:
# vi /var/named/murali.local
$TTL 86400
@ IN SOA murali.king.com. murali.king.com. (
1997022700 ; Serial
28800 ; Refresh
14400 ; Retry
3600000 ; Expire
86400 ) ; Minimum
IN NS murali.king.com.
9 IN PTR murali.king.com.
7. To config the service :
# vi /etc/named.conf
include "/etc/rndc.key";
zone"king.com" IN {
type master;
file "murali.zone";
allow-update { none; };
};
zone "0.0.127.in-addr.arpa" IN {
type master;
file "murali.local";
allow-update { none; };
};
• To update the service
# service named restart
# service network restart
# nslookup 10.0.0.9
# nslookup murali.king.com
#nslookup www.king.com
CHAPTER - 12
DHCP
DHCP DHCP
Client Server
D Discover
O Offer
R Request
A Acknowledgement
LAB Steps : (server side)
• TO Check the Package
# rpm –qa dhcp*
• TO Config the service file :
# vi /etc/dhcpd.conf
ddns-update-style none;
subnet 10.0.0.0 netmask 255.0.0.0
{
range 10.0.0.1 10.0.0.100;
}
• To update the services
# service dhcpd restart
Lab step ( Client side)
• Linux M/C:
# netconfig
select : yes
select : dynamic automatic [DHCP]
#service network restart
• Windows M/C:
go to network then select obtain an IP address
automatic
set the dns master IP address means dhcp
server IP address.
CHAPTER - 13
Network Services
• Client side :
#telnet 10.0.0.9 (server IP address)-----only client login
or
#rlogin 10.0.0.9