Вы находитесь на странице: 1из 0

Linux Complete Notes 1/74

Linux Complete Notes


A Complete Hands-On Experience on RHEL
by
Yogesh Vaishna
friendyogi@gmail.com
Linux Complete Notes 2/74
!edications"-
#o someone special $hom % couldn&t marry''((
friendyogi@gmail.com
Linux Complete Notes 3/74
Ac)no$ledgments"-
I acknowledge my parents for giving me education and letting me opt for taking computer as a
hobby, which became my profession later on. I would also like to thank my sisters, who
motivated me to achieve my goals.
I want to thank to my friends, colleagues, and my students as I alone could not have done it. I
would specially thank my friend and my guruz, Anand Chouksey , Arinjay Singh, Chayan
Sengupta, ajesh Sharma, Swaroop Singh !In alphabetical order". #hey remain mysterious and
each time I meet them, I am always left wondering on the depth of their knowledge on
$etwork and %inu&.
%ast but not the least' I would like to thank a girl, who brought light in my life when I needed it
the most. She gave me moral support and appreciation when I was loosing my heart and giving
up. She helped me reach my goals and made possible which I am today. I am indeed thankful
to her and honor her love and affection for me.
Yogesh Vaishna
**+*,+-.
friendyogi@gmail.com
Linux Complete Notes 4/74
/re0ace"-
(hy this book was written) has a simple and straight answer* #here $as direct need 0or it(
+eople, which includes professional system administrators and professional %inu& trainers, had
certainly spend some tough time while recalling those commands and procedures which just
sometimes so away from the mind. Similarly, in case of a network troubleshoot or a problem
hunt, there lacked proper se,uence to follow, which could identify the problems.
#his book is $-# a detailed theory based encyclopedia. +lease refer to %inu& .ocumentation
+roject for it. So in short you should not e&pect e&planation of things in this te&t. #his book is
$-# for newbie/s. #his is a reference book and should be treated as reference only. #here
might be things which might not work because of your machine or your particular
version0distribution of %inu&. As far as this book is concerned, all material is related to 12%.
#he book is divided into 3 sections, according to certification e&am 1C2.
%inu& basics, %inu& system administration and %inu& server administration.
+lease feel free to contact me about any errors, suggestions at*
friendyogi4gmail.com
friendyogi@gmail.com
Linux Complete Notes 5/74
License" -
5ou are allowed to reproduce this book in any form as far as the name of original author is
maintained in the new production. 5ou are not liable to give me any money nor are you
allowed to charge any money from any one e&cept the cost of the media used. I would
appreciate an email once you print this book in any number for any one.
Currently this book can be found at
http*00www.geocities.com0friendyogi06ploads0linu&notes.pdf
friendyogi@gmail.com
Linux Complete Notes /74
#able o0 Contents
Linux 1asics
7ilesystem 1ierarchy System 8
9asic Commands :;
<i 2ditor :3
6ser =roup Administration :>
+ermissions :8
Advanced +ermissions ?;
$etwork@Client Configuration ??
Linux 2ystem Administration
+artitions ?A
Swap 7ile system ?B
Cracking oot +assword ?B
=69 ?8
Symbolic %inks ?C
Duota 3;
AI. 3:
%<E 33
+E 3A
56E 3B
9ackup F estore 3C
emote Copy G;
Shell Scripting G:
7stab F Etab 7iles GG
Cron F At GA
9ooting Se,uence GB
+rocess Eanagement G8
Linux 2erer Administration
$7S A;
7#+ A:
Samba A3
.1C+ AA
.$S AB
Eail Server >:
(eb Server >3
+ro&y Server >A
$IS >B
Hickstart F $etwork Installation >C
<irtualization B:
$otes BG
friendyogi@gmail.com
Linux Complete Notes 7/74
Linux 1asics
friendyogi@gmail.com
Linux Complete Notes !/74
FILESYSTEM HIERARCHY SYSTEM
Linux uses single rooted, inverted tree like filesystem hierarchy
/ this is top level directory
it is parent directory for all other directories
it is called as ROOT directory
it is represented by forward slash(/
c!" of windows
/root it is home directory for root user (super user
#t provides working environment for root user
c!"$ocuments and %ettings"&dministrator
/home it is home directory for other users
#t provide working environment for other users (other than root
c!"$ocuments and %ettings"username
/boot it contains bootable files for Linux
Like vmlinu' (kernel((((( ntoskrnl
initrd(#)#Tial Ram $isk and
*R+,(*Rand +nified ,ootloader(((( boot(ini
/etc #t contains all configuration files
like /etc/passwd((((( user info
/etc/resolv(conf((( -referred $)%
/etc/dhcpd(conf(((( $./- server
c!"windows"system01"dirvers"
/usr ,y default softwares are installed in /usr directory
(+nix %harable Resources
c!"program files
/opt #t is optional directory for /usr
#t contains third party softwares
c!"program files
/bin #t contains commands used by all users
(,inary files
/sbin #t contains commands used by only %uper +ser(root
(super user2s binary files
/dev #t contains device files
like /dev/hda ((( for harddisk
/dev/cdrom ((( for cdrom
similar to device manager of windows
/proc #t contain process files
#ts contents are not permanent, they keep changing
#t is also called as 3irtual $irectory
#t2s file contain useful information used by O%
like /proc/meminfo ((( information of R&4/%5&-
/proc/cpuinfo ((( information of /-+
friendyogi@gmail.com
Linux Complete Notes "/74
/var #t is containing variable data like mails, log files
/mnt #t is default mount point for any partition
#t is empty by default
/media#t contains all of removable media like cdrom, pendrive
/lib #t contains library files which are used by O%
it is similar to dll files of windows
library files in linux are %O(shared ob6ect files
/tmp #t stored temporary files
friendyogi@gmail.com
Linux Complete Notes 1#/74
Basic commands:-
pwd(((( print present working dir
7root8sys9:;<= pwd
/root
7root8sys9:boot<= pwd
/boot
date(((((( to display date and time
= date (press enter
who (((((((( to see who is logged in
= who( press enter
whoami ((((( to show who is working on present terminal
= whoami (press enter
cal((( to show calendar
= cal
to show present month2s calendar
= cal 1::>
to show calendar of year 1::>
mkdir((((( make directory
syntax = mkdir ?dirname@
ex = mkdir one
= mkdir one/two
= mkdir one/two/three
we can use Ap option to create dir inside a dir
ex = mkdir Ap one/two/three
rmdir (((( to delete an empty dir
syntax = rmdir ? dir name@
ex = rmdir one
error(((((( $irectory not empty
= rmdir one/two/three
= rmdir one/two
= rmdir one
how to create files!A
we can use 2touch2 or 2cat2 command
touch command is used to create blank files
si'e of file created by touch is 'ero bytes
syntax = touch ?filename@
ex = touch first(txt
friendyogi@gmail.com
Linux Complete Notes 11/74
ex = touch second(txt thrid(doc fourth(bat
cat command is used to create file and display the contents of file also
syntax = cat @ ? new file name @
ex( = cat @ first(txt
type the contents of file here
ksld6fBlkas
asdkl6f6aBsdf
asdfashflk6asdfh
((((((((((((((((
press ctrl C d to save the file
how to see contents of file
ex = cat first(txt
type the contents of file here
ksld6fBlkas
asdkl6f6aBsdf
asdfashflk6asdfh
((((((((((((((((
how to copy file!
cp command is used to copy a file
syntax = cp ? source name @ ? target name @
ex = cp /root/first(txt /root/one/two/three
this command will copy first(txt file to three directory with same name
ex = cp /root/first(txt /root/one/two/three/new(txt
this command will copy first(txt file to three directory with new(txt name
by default cp command will not copy directory
we have to use Ar switch to copy directory also
ex = cp Ar /root/one/D /var
this command will copy all the contents of one directory to var directory
note!A we can use wildcard characters
D means multiple characters
E means single character
how to delete a file!
rm command is used to delete a file/directory
syntax = rm ? file/dir name @
ex = rm /root/first(txt
it will ask for confirmation, press y to delete file
ex = rm Af /root/first(txt
it will not ask for confirmation
friendyogi@gmail.com
Linux Complete Notes 12/74
to remove a directory also we have to use Ar option
ex = rm Arf /root/one
this command will delete one directory with all its contents,
without confirmation(
mv ((((( to move file/dir
this command is also used to rename file/dir
syntax = mv ? source name @ ? target name @
ex = mv /root/first(txt /root/one/two/three
this command will cut first(txt file and paste it in three directory
ex = mv /root/first(txt /root/new(txt
this command will rename first(txt file to new(txt
cd((((( change directory
syntax = cd ? dir name @
7root8sys9:;<= cd /var/log
7root8sys9: log<= pwd
/var/log
7root8sys9: log<= cd /root
7root8sys9:;<= pwd
/root
cd A 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 1 level parent directory
cd means to back to home directory of user
friendyogi@gmail.com
Linux Complete Notes 13/74
VI visual display edio!
VIM visual display edio! imp!oved
this is command mode editor for files
other editors are emacs, gedit
vi editor is most popular
it is having 0 modes!
9 command mode
1 insert mode (edit mode
0 extended command mode
#nsert mode!
i #nsert at current cursor position
# #nsert at start of line
a &ppend at current cursor position
& &ppend at the end of line
o #nsert line below cursor position
O #nsert line &bove cursor position
#nsAkey same as i
ex command mode!
!w to save the file
!wF to save and Fuit
!F to Fuit without saving
!FG to Fuit without saving (forcefully
!wFG to save and Fuit file (forcefully
Hused for read only filesI
!se nu to %Jt line )+mber
!se nonu to remove line number
!9K to move cursor to line no( 9K
command mode!
dd to delete a line (cut
Kdd to delete K lines (cut
yy to copy a line (yank
9:yy to copy 9: lines (yank
p to paste lines below cursor position
- to past lines above cursor position
u to undo
ctrlCr to redo
/?find what@ to find a text inside a file
.ow to find and replace!A
!?range@s/?find what@/?replace with@/?options@
range can be!
L complete file
9:,M from 9:th line to last line
9N,1: from 9Nth line to 1:th line
friendyogi@gmail.com
Linux Complete Notes 14/74
option can be!
g to replace all the occurrence in same line
i to ignore case sensitivity
ex( !9,Ms/cat/dog/gi
to find cat,/&T,/at,c&T and replace with dog in complete file
more and less commands are used to see the contents of a file page wise(
syntax( = more ? file name @
ex( = more file9(txt
now to see contents page wise press space
to see contents line wise press enter
less command is same as more
but to Fuit less command we have to press F
head (((((((( this command is used to see first 9: lines of a file(
ex( = head file9(txt
to see the first 2n2 lines!
ex( = head An file9(txt
tail ((((((( this command is used to see last 9: lines of a file(
ex( = tail file9(txt
to see the last 2n2 lines!
= tail An file9(txt
redirection!A used to give output of one command to a file(
ex( = cat file9(txt @@ file1(txt
this command will &--J)$ the contents of file9(txt to file1(txt
= ls Al @@ file0(txt
the output of 2lsAl2 is saved inside file0(txt file(
pipe!A used to give output of one command to another command
ex( = cat file9(txt O more
PP!PP
this is pipe symbol
)ote! grep!A *lobal Regular Jxpression -rint
awk!A The name &5Q is derived from the family names of its
authors R
alfred &ho, peter 5einberger, and brian Qernighan
= ll O grep STAS
to show only files
= ll O grep STdS
to show only directory
= ll O grep STAS O wc Al
to count no( of files
wc((((( word count
= wc file9(txt
it will show no( of lines
no( of words
friendyogi@gmail.com
Linux Complete Notes 15/74
no( of characters
= wc Al file9(txt
shows only no( of lines
= wc Aw file9(txt
shows only no( words
= wc Ac file(txt
shows only no( of characters(
friendyogi@gmail.com
Linux Complete Notes 1/74
"se! #!oup Adminis!aion
whenever a user is created in linux !A
its home directory is created(/home/username
its mail box is created(/var/spool/mail
uniFue +#$ U *#$ are given to user
+#$ for system users: to KVV
+#$ for normal users N:: to W:,:::
Redhat Jnterprise Linux and fedora used +-* scheme
+-*((( +ser -rivate *roup
it means that whenever a user is created is has its own private group
how to create user!
syntax( = useradd ?option@ ?username@
options are
Au user id
A* %econdary group id
Ag primary group id
Ad home directory
Ac comment
As shell
ex( = useradd user9
user9 is created
ex( = useradd Au 9::9 Ad /anydirectory As /bin/sh user1
user1 is created with uidX9::9,homeX/anydirectory, shellX/bin/sh
all of user information is stored in /etc/passwd file(
it contains Y fields!A
user9!x!N::!N::!!/home/user9!/bin/bash
9 1 0 K N W Y
9 user login name
1 mask password
0 uid
K gid
N comments( by default no comment
W user2s home directory
Y user2s login shell
after creating users we can modify its properties by using!
syntax( = usermod ?options@ ?username@
options are!
all of the options which are used with useradd command and,
Al to change login name
AL to LO/Q account
A+ to +)LO/Q account
ex( = usermod Al newname oldname
ex( = usermod AL newname
ex( = usermod A+ newname
note!A when a account is locked it will show G(exclamation mark in
/etc/shadow file(
friendyogi@gmail.com
Linux Complete Notes 17/74
how to set password!
syntax( = passwd ?username@
ex( = passwd user9
ex( = passwd root
the password information is stored inside /etc/shadow file
it contains encrypted password
linux uses 4$N and $J% algorithms for encrypting passwords
4$N 4essage $igest version N
$J% $ata Jncryption %tandard
how to delete a user account!
syntax( = userdel ?option@ ?username@
ex( = userdel user9
it will delete user9 but home directory will not be deleted
ex( = userdel Ar user1
it will delete user1 and home directory will also be deleted
to create a group!
syntax( = groupadd ?option@ ?groupname@
options!
Ag to set *#$
ex( = groupadd Ag 9:9: sales
ex( = groupadd mktg
to add/delete secondary users to group
syntax = gpasswd ?options@ ?user@ ?groupname@
ex( = gpasswd Aa user9 sales
to add a single user
ex( = gpasswd A4 user1,user0,userK sales
to add multiple users
ex( = gpasswd Ad user9 sales
to delete secondary user from member list
to delete group ( group must not contain any primary user
syntax( = groupdel ?groupname@
ex( = groupdel sales
note! all information of group is stored in /etc/group file
it contain list of secondary members also(
friendyogi@gmail.com
Linux Complete Notes 1!/74
$ERMISSI%&S:-
to see the present permission on any file!A
= ls Ald ?filename@
permission are applied on three levels!A
owner or user level
group level
others level
access modes are of three types!A
r read only
w write/edit/delete/append
x execute/run a command
access modes are different on file and directory
file dir
r open the file 2ls2 the contents of dir
w write, edit, append, delete file add/del/rename contents of dir
x to run a command/shell script to enter into dir using 2cd2
the output of ls Ald command shows following properties
ArwArAArAA 1 root root NK 9N march ((((( file9(txt
PPPPPPPPPP PP PPPP PPPP PP PPPPPPPPPPPPPP PPPPPPP
filetypeCpermission, links , owner, grp name of owner, si'e in bytes,
date of modification, file name(
file types!A
A normal file
d directory
l link file(shortcut
b block file(harddisk,floppydisk
c character file(keyboard,mouse
permission can be set on any file/dir by two methods!A
9 absolute method(numbers
1 symbolic method(ugo
to set the permission on file/dir 2chmod2 command is used
by default permissions on file and dir!A
file dir
root WKK YNN
normal user WWK YYN
here,
readXK
writeX1
executeX9
different permissions on file and directory!A
friendyogi@gmail.com
Linux Complete Notes 1"/74
file dir
read file can be open,read contents of dir can be listed (ls
write contents of file canbe changed contents of dir can be deleted, created
execute command/script can be run user can enter into dir (cd
how to set permission on file/dir!A
syntax( = chmod ?permission@ ?file/dir name@
ex( = chmod YYY /file9(txt
or
= chmod uXrwx,gXrwx,oXrwx /file9(txt
or
= chmod ugoXrwx /file9(txt
this command is used to give full permission to all(
ex( = chmod ::: /file(txt
or
= chmod uXA,gXA,oXA /file(txt
or
= chmod ugoXA /file(txt
this command is used to remove all permission(
note!A +4&%QA is the number which is removed from default permission of file/
dir(
default umask of root user is :11
default umask of unprivileged user is ::1
for root user!A
file dir
default perm( WWW YYY
subtract +4&%Q A:11 A:11
Resulting perm( WKK YNN
for normal user!A
file dir
def( perm( WWW YYY
subtract +4&%Q A::1 A::1
Resulting perm( WWK YYN
friendyogi@gmail.com
Linux Complete Notes 2#/74
Advanced $e!missions:
There are 0 types of adv( permissions!
%+#$ ((( userlevel
%*#$ ((( *rouplevel
%ticky bit others level
to set adv permissions by using numeric method we use
suid X K
sgid X 1
stickybitX 9
%+#$!A
#f suid is set on any command then any normal user can run
that command with privileges of root user
like, $efaultly ping command is having suid, so all users can
run that command but if suid is removed then 2permission denied2
ex(
= whereis ping
/bin/ping
= ls Ald /bin/ping
ArwsrAxrAx ((((((((((
PPPPP this means %+#$ is set by default
how to remove %+#$!
= chmod :YNN /bin/ping
= ls Ald /bin/ping
ArwxrAxrAx ((((((((((((((((
PPPP this means %+#$ is removed
how to check!
log in as normal user and try to ping
it will display error((((( operation not permitted
%*#$!A
%*#$ is used for group inheritance, files and directories will
get groupname from their parent directory
ex(
= mkdir /mywork
= chmod YYY /mywork
= chgrp sales /mywork
= chmod 1YYY /mywork
= ls Ald /mywork
now login as sales group members, create some files, and check their
properties
%ticky ,it!A
#f sticky bit is set, then only owner can delete that file/dir
ex(
= mkdir /mywork
= chmod 9YYY /mywork
= ls Ald /mywork
friendyogi@gmail.com
Linux Complete Notes 21/74
it will display rwt(((( for sticky bit
= su user9
M touch /mywork/file9
M exit
= su user1
M rm /mywork/file9
error(((( permission denied
friendyogi@gmail.com
Linux Complete Notes 22/74
&e'o!(-Clien con)i*u!aion:
ifconfig!A
#nterface configuration()etwork #nterface /ard
it is used to set ip addr temporarily
it is also used to check ip addr
how to set ip addr temporarily!A
= ifconfig eth: 9V1(9W>(9(Z
how to check ip add!A
= ifconfig eth:
it will display ip addr, hardware addr, subnet mask (((((
netconfig!A network configuration is used to set ip addr,
subnet mask, preferred dns, default gateway
how to set ip addr!
= netconfig ( press enter
ok
9V1(9W>(9(Z
1NN(1NN(1NN(:
enter
enter
ok
= service network restart
restart network service to update new ip addr
note!A if netconfig is not working then package is not installed
you can install this package by using rpm
systemAconfigAnetwork
or
neat( )etwork &dministration Tool
used to set ip addr in *raphical mode
ifup!A interface up
this command will enable lan card
= ifup eth:
ifdown!A interface down
this command will disable lan card
= ifdown eth:
ethtool!A used to check whether lan card is detected or not!
= ethtool eth:
yes
.ow to change .ostname!
hostname!A this command is used to set hostname temporarily
and view hostname
friendyogi@gmail.com
Linux Complete Notes 23/74
to see hostname!A
= hostname (press enter
to set hostname temporarily!A
= hostname sysZ
to make hostname permanent!A
= vi /etc/hosts
9V1(9W>(9(Z sysZ
= vi /etc/sysconfig/network
.O%T)&4JXsysZ
to check log off and log in again and use 2hostname2 command
friendyogi@gmail.com
Linux Complete Notes 24/74
Linux 2ystem Administration
friendyogi@gmail.com
Linux Complete Notes 25/74
$a!iions:-
fdisk command is used in linux to create ,delete, view, manage partitions
= fdisk Al
$isk /dev/hda! K9(9 *,, K99YK90>>>: bytes
$evice ,oot %tart cyl Jnd cyl ,locks #d [ile %ystem
/dev/hda9 D 9 9:1: >9V099>C Y .-[%/)T[%
/dev/hda1 9:19 9:00 9:KK11C >0 Linux
)ote!A 9,lockX9Q,
#d is used by system to identify the type of partition(
D means it is a boot partition(
.ow to create new partition!A
= fdsik ? device name @
= fdisk /dev/hda
command(m for help!
commands are!A
n new partition
d delete partition
p print partition table
t set system id(tag
w to save and Fuit
F to Fuit without saving
m prints this help
l to list system id
to create new partition!A
command(m for help! n
first cyl((((((((((! (press enter
si'e in mb Csi'e4((! C9::4
command(m for help! w
it will display warning!A kernel use old partition table(
= partprobe /dev/hda
now check partition!A
= fdisk Al
.ow to delete partition!A
first note the partition no( by using 2fdisk Al2 command(
for exampleAAAA/dev/hdaV
then,
= fdisk /dev/hda
command(m for help ! d
partition no((9AV ! V
command(m for help ! w
= partprobe /dev/hda
)ote!A don\t delete partition already created(
delete only that partition which u have created(
.ow to format partition!A
mkfs command is used to make file system(
friendyogi@gmail.com
Linux Complete Notes 2/74
to format partition using ext0 file system!A
= mkfs(ext0 /dev/hdaV
to format partition using ext1 file system!A
= mkfs(ext1 /dev/hdaV
to format partition using vfat file system!A
= mkfs(vfat /dev/hdaV
.ow to mount the formatted partition!A
mount command is used to create a link between physical partition
and an empty directory(
you can use /mnt directory for mounting any partition
or you can create your own dir( also
= mount ?device nameCpartition no(@ ? mount point@
= mount /dev/hdaV /mnt
= mount /dev/hda9: /cms
after mounting you can create file/dir in that partition!A
= cd /mnt
= touch 9 1 0 K
= mkdir one two three four
mount command is also used to check whether the partition is mounted
or not
= mount (press enter
it will show all currently mounted partitions
Label!Alabel of partition is name of partition
(ex( in windows (((((disk9]vol9, local disk
(ex( in linux ((((( /boot, /root
.ow to check current label!
= e1label ? partition no( @
= e1label /dev/hda9
= e1label /dev/hda1
how to change label!
= e1label /dev/hdaV 4yname
= e1label /dev/hda9: yourname
.ow to convert ext1 to ext0
= tune1fs A6 /dev/hdaV
.ow to convert ext0 to ext1
= tune1fs AO Thas]6ournal /dev/hdaV
(capital O
friendyogi@gmail.com
Linux Complete Notes 27/74
S+A$
swap is a file system, it is similar to virtual memory of windows
swap space is used to improve the system performance
.ow swap worksE
system identifies the idle process in R&4(memory and sends it to
swap space, so that R&4 again becomes free(
swap space is created on .ard disk
Rule to create %wapE
if si'e of R&4 ? 1*,
then si'e of %5&-X1DR&4
else
si'e of %5&-X 1 C R&4
.ow to view info about swap
= free
= more /proc/meminfo
= more /proc/swaps
= swapon As
As option is to show swap
.ow to increase %wap si'e
9( first create a new partition using fdisk command
ex( /dev/hdaV
1( make it a swap partition!A
= mkswap /dev/hdaV
0( enable swap on this partition!A
= swapon /dev/hdaV
check it by using 2swapon As2
note!A in first step, while creating partition we have to set system #$
by using 2t2 option
set tag no( >1 to make it swap/solaris partition(
if we not set tag(system #$ then swap partition will not work(
Ho' o B!ea( !oo pass'o!d:-
9( restart system
= init W
1( go to single user mode
at the grub boot screen select Redhat and press 2a2
then give space and type 292
then press enter
0( at the shell prompt change the root password
sh= passwd root
DDDDDD
DDDDDD
K( restart the system
= init W
friendyogi@gmail.com
Linux Complete Notes 2!/74
+,a is #R"B-
*Rand +nified ,ootloader is the default boot loader program for R.JLN
configuration file for *R+, is
/boot/grub/grub(conf
its contents are!A
defaultX: ((((((((default os is Redhat
timeoutXN ((((((((time to change os
splashimageX(hd:,9/grub/splash(xpm(g' ((((((((grahical screen
hiddenmenu ((((((((hides os options
title Red .at Jnterprise Linux %erver (1(W(9>A>(elN (((((( name of 9st os
root (hd:,9 ((((( partition
kernel /vmlinu'A1(W(9>A>(elN ro rootXL&,JLX/9 rhgb Fuiet (((kernel
initrd /initrdA1(W(9>A>(elN(img ((((( #nitial Ram$isk
title Other ((((((( name of 1nd os
rootnoverify (hd:,: O boot info
chainloader C9 O of 1nd os(windows
.ow to set *R+, password!A
9( = grubAmdNAcrypt @@ /boot/grub/grub(conf
now type password for two times
1( = vi /boot/grub/grub(conf
remove last 1 lines!A
password
retype password
cut last line where encrypted password is written(
paste it below 2 hiddenmenu 2
ex(!A
hiddenmenu
password AAmdN M910abc(xy'KNWMpFr(
title Red .at Jnter(((((
0( save and exit file, restart system and verify(
.ow to remove *R+, password!A
9( boot from R.JL 9st cd
1( at the boot prompt type 2linux rescue2 and press enter
boot! linux rescue
0( keyboard (((((( ok
K( language ((((( ok
N( network support (((( no
W( rescue ((((((((( continue
Y( shell will appear type following command!A
sh= chroot /mnt/sysimage
>( open grub configuration file and remove password line!A
sh= vi /boot/grub/grub(conf
delete line below 2hiddenmenu2
save and exit
V( remove cd and restart
friendyogi@gmail.com
Linux Complete Notes 2"/74
Sym.olic Lin(
There are two types of Links!A
.ard link %oft Link
9 si'e of both file is same si'e of link file is eFual to no(
of characters in the name of original file
1 can2t be created across can be created across
partition partition
0 inode no( of both file is inode no( of source and link file
same is different
K if original file is deleted if original file is deleted
then also link will contain link is broken and data is
data lost
N ,&/Q+- [#LJ %.ORT/+T [#LJ
command used to create .ard link!A
syn = ln ?source file@ ?target file@
to check use!A
= ls Aali
command used to create %oft link!A
syn = ln As ?source file@ ?target file@
to check use!A
= ls Aali
friendyogi@gmail.com
Linux Complete Notes 3#/74
/uoa:-
Fuota are used to restrict the amount of disk usage by any user,
group on a particular partition(
^+OT&
user level ( group level
blocks inodes (blocks inodes
(si'e in kb (no( of files ((si'e in kb (no( of files
inode!A #ndex node no( it is used by system to identify the
properties of file like, file type, permission, owner,
group, si'e in blocks, no( of links, time stamps(
#node no( is uniFue to a file(
how to see inode no(((((((((( = ls Ail ? file name@
steps to implement Fuota!A
9 create a new partition((fdisk
1 format it(mkfs(ext0
0 mount partition using userFuota,groupFuota option(mount
K check mounted partition(mount
N create user, group
W create Fuota file inside Fuota partition(Fuotacheck
Y enable Fuota on Fuota partition(Fuotaon
> specify Fuota limits(edFuota
0 = mount Ao usrFuota,grpFuota /dev/hdaZ /mnt
K = mount
N = useradd user9B =useradd user1
= passwd user9
= passwd user1
W Fuotacheck Acugv /dev/hdaZ
options!A
Ac to create Fuota database files
Au user Fuota
Ag group Fuota
Av verbose
to check whether files are created or not!A
= ls /mnt
Y = Fuotaon /mnt
> to set userlevel Fuota!A
= edFuota Au user9
to set group level Fuota!A
= edFuota Ag grpname
after >th step Fuota file will open
here,
soft means AAA limit after which warning message is displayed
hard means AAA limit after which error message is displayed
to check Fuota limits, log on as user and create file/dir
or use SrepFuota ?mnt point@S command
friendyogi@gmail.com
Linux Complete Notes 31/74
RAI0
Redundan A!!ay o) Ine1pensive2Independen 0is(
1 or more hard disk are combined to create R&#$, it is used in servers
with %/%# .arddisk(
Redhat supports following R&#$ Levels!A
R&#$ : (striping 1min 01max
R&#$ 9 (mirroring 1min 1max
R&#$ K (striping with -arity disk 0min 01max
R&#$ N (striping with distributed parity 0min 01max
how to implement R&#$ N on redhat!A
2mdadm2 command is used for administration of 4eta$isk in linux(
syntax( = mdadm A/ ?metadevice@ AnZ ?device9@ ?device1@((((( AlZ
A/ to create metadevice
An to set no( of harddisk
Al to set R&#$ level
ex( = mdadm A/ /dev/md: An0 /dev/hdaV /dev/hda9: /dev/hda99 AlN
/dev/md: is metadisk
/dev/hdaV,9:,99 are new partitions
An0 means no( of harddiskX0
AlN means R&#$ levelXN
after creating R&#$ to check it!A
ex( = mdadm A$ /dev/md:
A$ to display information
to use R&#$ -artition format it!A
ex( = mkfs(ext0 /dev/md:
make a mount point!A
ex( = mkdir /cms
now mount R&#$ -artition on /cms
ex( = mount /dev/md: /cms
now create some files and directory in /cms(
how to make any R&#$ $evice faulty
ex( = mdadm Af /dev/md: /dev/hda9:
/dev/hda9: from /dev/md: is now faulty
how to check it!A
ex( = mdadm A$ /dev/md:
it will show faulty deviceAAAAA /dev/hda9:
how to remove any [aulty $evice from R&#$
ex( = mdadm Ar /dev/md: /dev/hda9:
how to check it!A
ex( = mdadm A$ /dev/md:
it will show only 1 devices((((( one device is removed(
friendyogi@gmail.com
Linux Complete Notes 32/74
how to add newly created partition to already existing R&#$!A
ex( = mdadm Aa /dev/md: /dev/hda91
here /dev/hda91 is newly created partition(
how to check!A
ex( = mdadm A$ /dev/md:
it will show spare building for some time(
then it will show active synchronous(
friendyogi@gmail.com
Linux Complete Notes 33/74
LVM3333333 Lo*ical Volume Mana*e!3
#n linux, lvm is used to create logical partitions, called as
logical volumes(
we can easily resi'e logical volumes, without data loss(
L34 can be created using one or more harddisk(
5e will implement L34 on 0 different partitions of single harddisk(
$iagram!A
.ow to create -hysical 3olume!A
= pvcreate /dev/hdaV /dev/hda9: /dev/hda99
.ow to check -hysical 3olume!A
= pvdisplay O more
.ow to create 3olume *roup (name of volume group is /4%!A
syntax = vgcreate ?vgname@ ?pv9@ ?pv1@ ?pv0@ (((((((((
= vgcreate cms /dev/hdaV /dev/hda9: /dev/hda99
.ow to check 3olume *roup!A
syntax = vgdisplay ?vgname@
= vgdisplay cms
.ow to create Logical 3olume (name of Logical 3olume is L#)+Z!A
syntax = lvcreate AL Csi'e4 ?vgname@ An ?lvname@
= lvcreate AL C9::m cms An linux
another logical volume(name is //)&!A
= lvcreate AL CN:m cms An ccna
another logical volume(name is 4/%&!A
= lvcreate AL CW:m cms An msca
.ow to check Logical 3olume!A
syntax = lvdisplay ?lvname@
= lvdisplay linux
= lvdisplay ccna
= lvdisplay mcsa
.ow to write data into Logical 3olume!A
first format Logical 3olume!A
= mkfs(ext0 /dev/cms/linux
then mount Logical 3olume on a $irectory!A
= mount /dev/cms/linux /mnt
now create some files/dir in mount point!A
= cd /mnt
= touch 9 1 0 K N
.ow to resi'e L3!A
syntax = lvresi'e AL C/Asi'e4 ?lvname@
= lvresi'e AL C9:4 /dev/cms/linux
= lvresi'e AL A1:4 /dev/cms/linux
.ow to remove L3!A
= lvremove /dev/cms/mcsa
.ow to add new -hysical 3olume to already existing 3olume *roup!A
friendyogi@gmail.com
Linux Complete Notes 34/74
first create new partition(((((((((( /dev/hda91 using fdisk
now create physical volume!A
= pvcreate /dev/hda91
now add this physical volume to 3olume *roup!A
= vgextend cms /dev/hda91
friendyogi@gmail.com
Linux Complete Notes 35/74
R$M
RedHa $ac(a*e Mana*e!
sample rpm file!A
vsftpdA1(:(NA9:(elN(i0>W(rpm
pakagenameAversionArelease(enterpriselinuxN(architecture(extension
There are two way to install rpm!A
9 standalone installation(rpm file is on your sys/cdrom
1 network installation(rpm file is on %erver
.ow to install rpm Locally(standalone installation!A
first mount cd/dvd on /mnt directory!A
= mount /dev/dvdwriter /mnt
= cd /mnt
= cd %erver
= ls vsftpdD
vsftpdA1(:(NA9:(elN(i0>W(rpm
now install this package!A
= rpm ivh vsftpdA1(:(NA9:(elN(i0>W(rpm
preparing((((( ============================79::L<
=====================================79::L<
options!A
i install package
+(capital + +pgrade -ackage
v verbose mode installation
h hash
AAforce to forcefully install package, overwrite previous
installation(
AAnodeps to remove package but dependency will not be removed(
Ae to erase/remove installed packages
AF to Fuery installed packages
AFa to Fuery all installed packages
AFd to see documentations files inside package
AFl to see all files inside package
AFs to see the status of files inside package
AFi to see detailed information of installed package
AFip to see detailed info of not installed package
.ow to install packages from network server!A
)ote!A ip addr of server in lab is 9V1(9W>(9(9:
share directory name is /var/ftp/pub/%erver
here all rpm are already copied(
on client machine!A
method 9!A )[%
first ping server
= ping 9V1(9W>(9(9:
friendyogi@gmail.com
Linux Complete Notes 3/74
then mount the shared directory from server to any local directory!A
= mount 9V1(9W>(9(9:!/var/ftp/pub/%erver /mnt
PPPPPPPPPPPP PPPPPPPPPPPPPPPPPPP PPPP
#- add of server!/location of shared dir local dir(
go to mount point
= cd /mnt
now install package!A
= rpm Aivh ?package name C version@
= rpm Aivh vsftpdA1(:(NA9:(elN(i0>W(rpm
(try dialog rpm also
method 1!A [T-
first ping server
= ping 9V1(9W>(9(9:
then install packages using ftp method!A
= rpm Aivh ftp!//9V1(9W>(9(9:/pub/%erver/?pakage nameCversion@
= rpm Aivh ftp!//9V1(9W>(9(9:/pub/%erver/vsftpdA1(:(NA9:(elN(i0>W(rpm
friendyogi@gmail.com
Linux Complete Notes 37/74
Y"M
Yello'0o* "pdae! Modi)ied
yum feature was available with fedora, now it is available in R.JLN
R-4 feature is used to install packages but its main drawback is
[ailed $ependency Resolution(
yum automatically identifies dependency in packages,U install those
dependencies also(
by using _+4 we can install, remove, list packages and group of packages(
Repository!A it is the place where we create R-4 $ump
on server we copy all rpm from R.JL cd/dvd
here a list of all those packages is created
this list of packages is called Repository(
generally we copy all rpm of 2%erver2 directory of rhel cd/dvd to
/var/ftp/pub/%erver directory on %erver(
%erver side configuration!A
9( copy rpms from cd/dvd to /var/ftp/pub/%erver
1( install package createrepoD from cd
0( create repository
K( edit configuration file /etc/yum(repos(d/rhelAdebuginfo(repo
/lient side configuration!A
9( check ip addr
1( ping server(9V1(9W>(9(9:
0( edit configuration file /etc/yum(repos(d/rhelAdebuginfo(repo
K( start installing packages using 2yum2 command(
steps for %erver!A
if vsftpd package is not installed then install it
make dir((( /var/ftp/pub/%erver
9 = mount /dev/dvdwriter /mnt
= cp Ar /mnt/%erver/D /var/ftp/pub/%erver
PPPPPPPPPPPPPP PPPPPPPPPPPPPPPPPPP
source target
= cd /mnt
1( = rpm Aivh createrepoD
0( = createrepo Ag /mnt/%erver/repodata/compsD /var/ftp/pub/%erver/
source target
K( = vi /etc/yum(repos(d/rhelAdebuginfo(repo
edit following lines!A
=baseurl (remove hash
=enabled (remove hash
baseurlXftp!//?server ip adr@/pub/%erver
(9V1(9W>(9(9:
enabledX9

steps for /lient side configuration!A
6ust edit same file /etc/yum(repos(d/rhelAdebuginfo(repo
friendyogi@gmail.com
Linux Complete Notes 3!/74
and start installing packages using 2yum2 command
yum command !A
= yum install ?pakagename@ rpm Aivh ?pkgname@
= yum remove ?pakagename@ rpm Ae ?pkgname@
= yum list installed rpm AFa
= yum list installed ?pakagename@ rpm AF ?pkgname@
= yum grouplist AAAAA
= yum upgrade ?pakagename@ rpm A+vh ? pkg name@
= yum groupinstall ?grpname@ AAAAA
= yum `y update command to update all
friendyogi@gmail.com
Linux Complete Notes 3"/74
BAC4"$ 5 REST%RE
T&R!A tape archive
this command is used to create archive(
syntax! = tar ?option@ ?destination@ ?source@
options are!A
Ac to create a new archive
Av verbose mode
Af to create archive of files also
Ax to extract archive
A' to 'ip archive using g'ip
A6 to 'ip archive using b'ip1
= tar Acvf /var/home(tar /home
to create archive of /home directory inside /var directory
= tar Atvf /var/home(tar
to see the contents of home(tar archive without extracting
= tar Axvf /var/home(tar
to extract /var/home(tar inside /var
= tar Axvf /var/home(tar A/ /home
to extract /var/home(tar to /home directory
= tar Acvf' /var/home(tar/home
to create a tar of /home and 'ip it using g'ip utility
= tar Axvf' /var/home(tar
to extract home(tar using gun'ip utility
= tar Acvf6 /var/home(tar/home
to create tar and 'ip it using b'ip1 utility
= tar Axvf6 /var/home(tar
to extract home(tar uing bun'ip1 utility
after creating tar how to 'ip
there are two 'ip commands used, g'ip/gun'ip and b'ip1/bun'ip1
b'ip1 is more powerfully than g'ip
to 'ip using g'ip!A
= g'ip ?tar file name@
= g'ip /var/home(tar
= ls Ald /var/home(tar(g'
to un'ip using gun'ip!A
= gun'ip /var/home(tar(g'
to 'ip using b'ip1!A
= b'ip1 /var/home(tar
= ls Ald /var/home(tar(b'1
to un'ip using bun'ip1!A
= bun'ip1 /var/home(tar(b'1
friendyogi@gmail.com
Linux Complete Notes 4#/74
Remoe copy:-
scpAAAA secure copy
this command is used to copy contents of remote system,
we can take remote backup using this command
syntax = scp Ar ?source@ ?target@
= scp Ar 9V1(9W>(9(9!/home 9V1(9W>(9(1!/tmp
source pc target pc
this command will ask for root password of remote pc
)ote!A this command is based on ssh
ssh is %ecure %.ell
ssh is secure version on telnet
it uses port no( 10 like telnet
but the data, password sent using ssh is secure because
it encrypts data before sending
using ssh we can %.&RJ RJ4OTJ $J%QTO- in text mode(
.O5E
= ssh ?ip add of remote pc@
password of root!
to run a command on remote pc!A
= ssh ?ip add of remote pc@ ?command@
= ssh 9V1(9W>(9(9 init :
this command will shutdown 9V1(9W>(9(9 pc
friendyogi@gmail.com
Linux Complete Notes 41/74
SHELL SCRI$TI&#
= grep 2root2 /etc/passwd
= date AAhelp O grep year
= cut Ad! Af9 /etc/passwd
= grep bash /etc/passwd O sort
= cut Ad! AfY /etc/passwd O sort O uniF
first shell script!A
= vi first(sh
=/bin/bash
echo S this is my first shell script S
echo S Jnter your [irst name!(((((((((( S
read firstname
echo S Jnter your Last name!((((((((((( S
read lastname
echo S _our [ull )ame #s !((((((((((((( Mfirstname Mlastname S
save this file and give execute permission
now to run this shell script !
= (/first(sh
or
= bash first(sh
second shell script!A
= vi second(sh
=/bin/bash
echo Senter yes or noS
read ans
ansXSM(echo Mans O tr 2&Aa2 2aA'2S
echo SMansS
save the file and give execute permission
now run shell script!
= (/second(sh
)ote!A tr means translate character
used to translate characters
sed means %tream J$itor
used to edit output, without effecting original file
= vi pets
hi this is my pet animals file
i have a lot of pet animals
like
cat dog parrot and rabbit
but my fav( is cat
my cat is very soft
cat is white in color
dog is black in color
friendyogi@gmail.com
Linux Complete Notes 42/74
save the file and exit
= sed 2s/cat/dog/2 pets
this command will show edited output
all cat will be converted to dog in output
but the file will remain unaffected
= grep 2Troot!2 /etc/passwd
to filter info of root user only
echo S this is date and time M(dateS
echo Spwd is ! M(pwdS
if 7 Ad M9 <
then
echo S M9 is a dirS
else
if 7 Af M9 <
then
more M9
fi
fi
capitalXdehli
echo Swhat is capital of indiaS
read cap
if 7 Mcap GX Mcapital <
then
echo SwrongS
exit 9
else
echo S correct S
fi
echo S enter ur weightS
read wt
if 7 Mwt Alt N:: <
then
echo
read a
read b
cXPexpr Ma C MbP
echo Mc
for x in 9: 1: 0:
do
echo Mx
done
cat @ animal
cat
dog
fly
friendyogi@gmail.com
Linux Complete Notes 43/74
goat
lion
for i in Pcat animalP
do
echo S MiS
done
friendyogi@gmail.com
Linux Complete Notes 44/74
FSTAB and MTAB
2ec2)sa. and 2ec2ma. )iles
[%T&,AAAA [ile %ystem Table file stores information about partition,
file type, mount point, and mounting options
system reads this file at the time of booting, and mounts the partitions
which are listed in this file
common contents of /etc/fstab are!
L&,JLX/ / ext0 defaults 9 9
L&,JLX/boot /boot ext0 defaults 9 1
L&,JLX/home /home ext0 defaults 9 1
L&,JLX/usr /usr ext0 defaults 9 1
L&,JLX/var /var ext0 defaults 9 1
L&,JLX%5&-AhdaY swap swap defaults : :
/dev/hdaV /mnt ext0 defaults : :
label of partition mnt pt filesystem options dump fsck
how to see label of partition!A
= e1label /dev/hda1
/boot(((((((( this is the label of /dev/hda1 partition
/etc/mtab((((( 4O+)T T&,LJ
this file provides system the information about mounted partitions
S mount S command uses the contents of this file
)ote!A
when we mount any partition by using 2mount2 command, then
/etc/mtab file is updated and new entry is added
but this type of mounting is temporary
after rebooting the system it is automatically unmounted
so to mount a partition permanently we use /etc/fstab file
we have to manually edit this file to mount a partition permanently
ex(
a new partition is created /dev/hdaV, it is formatted
to mount it temporarily,
= mount /dev/hdaV /mnt
to mount it permanently,
= vi /etc/fstab
at the bottom of this file type following line
/dev/hdaV /mnt ext0 defaults : :
or you can change mounting options
/dev/hdaV /mnt ext0 defaults,usrFuota 9 1
friendyogi@gmail.com
Linux Complete Notes 45/74
Tas( Auomaion .y usin* 6c!on6 and 6a6
cron daemon is used to automate any task,
by using cron daemon we can run any task in background on particular
date and time, this is similar to schedule task of windows
main configuration file is /etc/crontab
daemon name is crond
to add a new task !A
= crontab Ae
this will open a blank file,
it is having following fields!
min hr date month day of week task(command
:N 9N 1K :K D mkdir /root/auto
this task is to create SautoS dir in /root at :0!:Npm on 1K/:K/:>
the task will be completed in background
to restart cron service!
= service crond restart
to see current pending task!A
= crontab Al
to remove any task!A
= crontab Ar
a
this command is used to schedule task for one time only!
= at 90!0:
at@ touch /root/breaktime
at@ (press ctrlCd to save
how to check it
= atF
it will display task no( and time
how to remove any task !
= atrm ? task no(@
ex(
= at 90!1V
at@ e6ect
at@ ctrlCd
= at 90!0:
at@ e6ect At
at@ ctrlCd
= at 90!09
at@ e6ect
at@ ctrlCd
friendyogi@gmail.com
Linux Complete Notes 4/74
check task list!
= atF
1
0
K
remove any particular task
= atrm K
friendyogi@gmail.com
Linux Complete Notes 47/74
B%%TI&# $R%CESS o) LI&"7
9 -O%TXXX -O5JR O) %JL[ TJ%T
to check the connectivity of necessary hardware(
1 ,#O%XXX ,&%#/ #)-+T O+T-+T %_%TJ4
to identify boot device
0 4,RXXXX 4&%TJR ,OOT RJ/OR$
it is first N91bytes of hard disk
it keeps the information of boot loader(*R+,
K *R+,XXX *R&)$ +)#[#J$ ,OOT LO&$JR
*R+, is default boot loader for linux machine
it is loaded into memory(R&4 by 4,R
it is capable of reading ext0 partition directly
*R+, is having 1 stages!A
9 %T&*J
it loads second stage loader
1 %T&*J
it reads /boot/grub/grub(conf file
and loads kernel(vmlinu', and initrd
(#nitial Ram $isk
vmlinu' file is kernel of redhat linux
it is heart of operating system
it is responsible for establishing link between system
hardware and shell
then kernel loads initrd
initrd loads device drivers so that kernel can
communicate with hardware(
N #)#TXXX #)#T#&L#a&T#O) O[ OT.JR -RO/J%%
then kernel initiali'e first process that is init
init is responsible for running other process, like
auditd, syslog, portmap, cups, sshd, xinetd, vsftpd,
dhcpd, crond, atd, yumAupdatesd, haldaemon(
all these deamons are inside /etc/init(d directory

W ,oot specific files!A
/etc/rc(d/rc(sysinit
/etc/rc(d/rc(local
/etc/inittab(((( to define default runlevel
(((to define prefdm(preferred display manager
(bashrc ((((( inside user2s home directory
((((( to define user specific aliases
ex( alias viXvim
Y Login prompt and after that if it is runlevel N then Z99 server
is started and gdm/kdm/xdm will provide graphical desktop(
friendyogi@gmail.com
Linux Complete Notes 4!/74
$R%CESS MA&A#EME&T:-
.ow to manage different process!A
system identifies any process by its process id(-#$
how to see pid of a running process!A
= service vsftpd status
vsftpd is running (0VNK(((((((
(this is pid
or
= ps Aef O grep vsftpd
)ote!A -#$ for init is always 9
how to start any process(daemon
= service vsftpd start
how to stop a process
= service vsftpd stop
how to restart any process
= service vsftpd restart
how to reload the process
= service vsftpd reload
when we restart the service is shutdown and again started, it takes time
when we reload service only changes are reloaded, it is fast
if any service is not responding then we can use kill command to
abnormally terminate that process!A
= kill ?pid of that process@
= kill 0VNK
note !A first check the pid of process, then kill it(
how to make any process to run permanently in any runlevelE
chkconfig command is used
like,
= chkconfig vsftpd on
to make vsftpd run by default in all possible runlevels
= chkconfig AAlevel 0N vsftpd on
to make vsftpd run by default in runlevel 0 and N only
= chkconfig AAlist O grep vsftpd
to see present on/off status of vsftpd service
= chkconfig vsftpd off
to turnoff vsftpd service in all possible runlevels
friendyogi@gmail.com
Linux Complete Notes 4"/74
Linux 2erer Administration
friendyogi@gmail.com
Linux Complete Notes 5#/74
&FS --- &e'o!( File Sysem
)[% server is used to share a dir between linuxAlinux or linuxAunix machine
)[% %JR3JR!A system which share(export its directory for network
)[% /L#J)T!A system which mounts server2s directory
)[% %JR3JR configuration !A
packages!A nfsAutilsD
portmapD
port no( 1:KV(((( nfs
999(((((portmap
configuration file /etc/exports
%ervices nfs
portmap
$aemon statd,mountd,lockd,nfsd
%teps!A
server side!A
create share folder!A
= mkdir /share
give full permission!A
= chmod YYY/share
export(share this directory!A
= vi /etc/exports
/share 9V1(9W>(9(:/1NN(1NN(1NN(:(rw,sync
)OTJ!A /share D(ro,async
restart service!A
= service portmap restart
= service nfs restart
client side!A
mount server2s dir on /mnt
= mount 9V1(9W>(9(9:!/share /mnt
check the contents!A
= cd /mnt
= ls
)ote!A = showmount Ae ?ip add@
this command is used to see what is shared on 2ip add2
friendyogi@gmail.com
Linux Complete Notes 51/74
FT$ SERVER
[#LJ TR&)%[JR -ROTO/OLA used to upload and download files from ftp server
following are different ftp server!A
wuftp washington university ftp
proftp
vsftp very secure ftp
[T- %JR3JR!Asystem which is having shared file/dir
[T- /L#J)T!A system which is uploading/downloading file to server
-ackages!A vsftpdD(rpm
-ort no( 1: for data transfer
19 for connection control
configuration file /etc/vsftpd/vsftpd(conf
/etc/vsftpd/user]list
/etc/vsftpd/ftpusers
services vsftpd
$aemon vsftpd
%teps!A
9 check for installed packages
= rpm AF vsftpd
if not installed then install it using nfs method
= mount 9V1(9W>(9(9:!/var/ftp/pub /mnt
= cd /mnt
= cd /%erver
= rpm Aivh vsftpdD
1 create shared dir inside /var/ftp
= cd /var/ftp
= mkdir upload
= mkdir download
give write permission on upload directory
= chmod ugoCw upload
create some files in download directory
= cd download
= touch one two three
0 open main configuration file!A
= vi /etc/vsftpd/vsftpd(conf
you can change any of the following options!A
line no(
91 anonymous]enableX_J%
to allow anonymous user to log into ftp server
user name for anonymous users are,
ftp
anonymous
9N local]enableX_J%
to allow local users that are created on server machine to log into ftp server from
client side
friendyogi@gmail.com
Linux Complete Notes 52/74
example of local users is user9,user1,ra6,ravi
1Y anon]upload]enableX_J%
to allow users to upload file to ftp server
by default any user is not permitted to upload files to server, he can only download
99N userlist]enableX_J%
K restart ftp service
= service vsftpd restart
or to reload service without shutting down use!A
= service vsftpd reload
/lient %ide configuration!A
9 connect to ftp server!A
= ftp 9V1(9W>(9(9:
(ip addr of server
it will ask for username, password
default user is ftp/anonymous
default password is ftp/anonymous
or you can also use any username that is created on server(local user
1 download files
go to download directory
ftp@ cd download
ftp@ get one
0 upload file
go to upload directory
ftp@ cd upload
ftp@ put localfilename
K disconnect ftp server
ftp@ bye
)ote!A
if local]enableX_J% is given in vsftpd(conf file
it means local users of server can also login from client side
ex( of local users are user9,user1, and even root
but by default root user is )OT allowed to login from network
so to deny any local user to login into ftp server, enter its name in
ftpusers file or user]list file, and reload the service
.ow to access [T- %erver in graphical mode!A
open web browser( mo'ila firefox
type addr
ftp!//?ip addr of ftp server@
like
ftp!//9V1(9W>(9(9:(press enter
friendyogi@gmail.com
Linux Complete Notes 53/74
SAMBA SERVER
5indows O% share file/folders using %4,(server message block protocol
5indows O% share file/folder over tcp/ip by using /#[%(common internet
file sharing method
Linux uses %4,$/)4,$ to share file and folders with windows machine
for this we have to configure samba server on linux machine
packages samba,sambaAcommon,sambaAclient,swat
portno( 90Y )et,#O% name service
90> )et,#O% datagram service
90V )et,#O% session service
configuration file /etc/samba/smb(conf and /etc/samba/smbpasswd
service smb
$aemon smbd,nmbd
%erver side configuration!A
9 install the packages if not already installed
= yum install sambaD
1 open main configuration file
= vi /etc/samba/smb(conf
go to last line
copy last > lines(press yy
paste at the bottom of file (press p
now edit last > lines by removing B(comment
7myshare< (((((((((( this is share name
comment X This is /4% shared directory (((( you can type any comment
path X /var/share (((((((((((((((( this is path of shared directory
valid users X user9 ((((((((((((((( space separated list of users
public X no (((((((((((((((((((( to make folder visible to all
writable X yes (((((((((((((((((( to give write permission on folder
browseable X yes (((( to see icon of shared folder in 2my network places2
0 create your shared directory
= cd /var
= mkdir share
= cd share
= touch file9 file1 file0
K start the service
= service smb restart
/lient %ide configuration!A
there are 1 methods in which we can access samba server from linux client
)[%!A
= mount //?ip add of samba server@/?share name@ ?mountpt@ Ao
usernameXsmbusername
= mount //9V1(9W>(9(9:/myshare /mnt Ao usernameXuser9
[T- method!A
= smbclient //?ip add of server@/?share name@ A+ username
= smbclient //9V1(9W>(9(9:/myshare A+ user9
friendyogi@gmail.com
Linux Complete Notes 54/74
smb@ls
smb@get file9
smb@put anyfile
smb@Fuit
)ote !A on samba server you must create user and provide smb password
= useradd user9
= smbpasswd Aa user9
DDDDD
DDDDD
to access samba server in graphical mode in linux go to
placesAAAA@ )etwork %erversAAAAAAAA@ system name
here you will find shared folder
.ow to access samba server from windows machine!A
go to my network places
entire network((((( find linux machine icon
here you will find shared folder
friendyogi@gmail.com
Linux Complete Notes 55/74
0HC$---- 0Y&AMIC H%ST C%&FI#"RATI%& $R%T%C%L
package dhcpA0(:(NA0(elN
configuration file /etc/dhcpd(conf
/usr/share/doc/dhcpA0(:(N/dhcpd(conf(sample
/var/lib/dhcpd/dhcpd(leases
port no( WY bootp server
W> bootp client
service dhcpd
$aemon dhcpd
.ow to configure dhcp server!A
check for dhcp package install!A
= rpm AF dhcp
if it is not installed then install it!A
= yum install dhcpD
now copy sample file to main configuration file!A
= cp /usr/share/doc/dhcpD/dhcpd(conf(sample /etc/dhcpd(conf
source sample file target main file
edit main configuration file
= vi /etc/dhcpd(conf
define the subnet with its class if ip addr
go to line no( 19
range dynamicAbootp 9V1(9W>(9(91> 9V1(9W>(9(1NKB
start range end range
save and exit
restart the service!A
= service dhcpd restart
on client side issue following command to obtain ip addr automatically
from dhcp server!A
= dhclient
or
= netconfig
yes
D use dynamic #- configuration7bootp/dhcp<
then restart the service
= service network restart
or
user graphical method
= systemAconfigAnetwork
or
= neat
check the new ip addr
= ifconfig eth:
friendyogi@gmail.com
Linux Complete Notes 5/74
.ow to give $./- reservation!A
we can bind any 4&/ addr to a #- addr by using dhcp ip address reservation
first we have to find out the mac addr of client!A
= ifconfig
it will show harware addr
now on dhcp server open main configuration file!A
= vi /etc/dhcpd(conf
modify following lines!A
hardware ethernet 91!0K!NW!Y>!&,!/$B
fixedAaddress 9V1(9W>(9(9N:B
save and exit, then restart dhcp service
note!A if you want to see mac addr of client from server machine then
= ping 9V1(9W>(9(Z
= arp Aa (press enter
friendyogi@gmail.com
Linux Complete Notes 57/74
0&S--- 0omain &ame Se!ve!2Se!vice
$)% server is used to resolve .ostname to #- addr and #- addr to .ostname
$)% server maintains aone files
aonefiles are database which contains information about different server
and their corresponding ip addr
there are two type of 'one database files!A
[orward Lookup aone file!A
This file contain .ostname and corresponding #- add
#t is used in .ostname to #p addr resolution
Reverse Lookup aone file!A
This file contain #- addr and corresponding .ostname
#t is used in #p addr to hostname resolution
5hen .ostname is added to $omain name it becomes [^$)
sys9:(cms(com(
sys9:AA hostname
cmsAA domain name
(comAA top level domain
( root domain
& $)% server will have following records!A
%O& record %tart Of &uthority record
[irst record created when a dns is configured
+sed for defining replication between $)% and ,akup $)%
& &ddress record
+sed to show it #p &ddr of any hostname
-TR -ointer record
+sed to show hostname of any #- &ddr
)% )ame %erver record
+sed to identify nameserver(dns server
/)&4J /anonical )ame record
+sed to provide alias/duplicate names to server
4Z 4ail Jxchange record
+sed to identify 4ail server
There are two types of $)% servers!A
4aster and %lave
4aster is having all 'one records, its %O& no( is always greater than
%lave(
%lave is having backup of 'one records of 4aster server, when any new
entry is entered in master server2s 'one file, it is automatically
replicated to slave, its %O& no( is always smaller than 4aster
.ow to configure 4aster $)% in Linux!A
packages bindD cachingAnameserverD
friendyogi@gmail.com
Linux Complete Notes 5!/74
portno( N0
main conf file /etc/named(rfc9V91('one
/etc/named(cachingAnameserver(conf
%ervice named
$aemon named
)ote!A $)% works on ,#)$(,erkely #nternet )ame $omain version V
#n R.JL we call bind as named(nameserver daemon
%teps!A
check ip addr!A
= ifconfig
if it is not correct set ip addr
= neat
or
= netconfig
restart network service!A
= service network restart
check hostname
= hostname
if it is not correct then set hostname
= hostname sysZ(cms(com
make it permanent!A
= vi /etc/hosts
9V1(9W>(9(Z sysZ(cms(comsysZ
= vi /etc/sysconfig/network
hostnameXsysZ(cms(com
now logout and login again to check hostname
check for package!A
= yum list installed bindD
if it is not installed, then install it!
= yum install cachD
= yum install bindD
total V packages
edit configuration files!A
= vi /etc/named(cachingAnameserver(conf
listenAon port N0 H 91Y(:(:(9B9V1(9W>(9(9:B IB
allowAFuery H localhostB9V1(9W>(9(:/1KB IB
matchAclients H localhostB9V1(9W>(9(:/1KB IB
= vi /etc/named(rfc9V91('ones
friendyogi@gmail.com
Linux Complete Notes 5"/74
copy line no( 19 to 09 ( 99 lines
paste it below line no( 09
edit these lines!
'one Scms(comS #) H
type masterB
file Scms(forSB
IB
'one S9(9W>(9V1(inAaddr(arpaS #) H
type masterB
file Scms(revSB
IB
change directory!A
= cd /var/named/chroot/var/named
copy and rename file localhost('one
= cp Ap localhost('one cms(for
copy and rename file named(local
= cp Ap named(local cms(rev
modify 'one database file!A
= vi cms(for
MTTL >WK::
8 #) %O& sys9:(cms(com( root(cms(com( (
K1 B serial (d( adams
0. B refresh
9N4 B retry
95 B expiry
9$ B minimum
#) )% sys9:(cms(com(
#) & 91Y(:(:(9
sys9:(cms(com( #) & 9V1(9W>(9(9:
sysV(cms(com( #) & 9V1(9W>(9(V
sys1(cms(com( #) & 9V1(9W>(9(1
= vi cms(rev
MTTL >WK::
8 #) %O& sys9:(cms(com( root(localhost( (
9VVY:11Y:: B %erial
1>>:: B Refresh
9KK:: B Retry
0W::::: B Jxpire
>WK:: B 4inimum
#) )% sys9:(cms(com(
9: #) -TR sys9:(cms(com(
V #) -TR sysV(cms(com(
friendyogi@gmail.com
Linux Complete Notes #/74
1 #) -TR sys1(cms(com(
open resolv(conf file and enter the ip addr of dns server
this file is similar to preferred dns of windows os
= vi /etc/resolv(conf
nameserver 9V1(9W>(9(9:
now restart service!A
= service named restart
client side configuration!A
provide the ip addr of dns server in resolv(conf file(preferred dns
= vi /etc/resolv(conf
nameserver 9V1(9W>(9(9:
Fuery dns server and check the output!A
we can check dns server by two commands!A
nslookup and dig
= nslookup
enter the server name
the output will be ip addr of server
= dig sys9:(cms(com(
or
= dig Ax 9V1(9W>(9(9:
friendyogi@gmail.com
Linux Complete Notes 1/74
MAIL SERVER:-
4&#L server uses 4T&( mail transfer agent like sendmail, Fmail, postfix
sFuirrelmail, smail etc
4T& uses %4T- protocol to send and receive mail at port no( 1N
on the client side mail client software like mutt(4utt 4ail +ser agenT, thunderbird,
evolution, and webmail are used to send and receive mail(
.ow to configure 4ail server (sendmail!A
packages sendmailD mKD
portno( 1N %4T-
99: -O-0
9K0 #4&-
config file /etc/mail/sendmail(mc
/etc/mail/sendmail(cf
service sendmail
daemon sendmail
%erver side configuration!A
install the packages if not already installed
= yum remove sendmailD
= yum install sendmailD
open main configuration file!A
= vi /etc/mail/sendmail(mc
edit following line no(
99W add S= dnlS at the beginning of line
9NN add S= dnlS at the beginning of line
(delete to new line
compile this file and send its contents to sendmail(cf file
= mK /etc/mail/sendmail(mc @ /etc/mail/sendmail(cf
note! this command will not show any output on screen
mK is a macro compiler which is used to compile sendmail(mc file
start service
= service sendmail restart
set hostname ((((((((( mail(cms(com
set ip addr
on client side!A
set hostname((((((((((((( sysZ(cms(com
set ip addr
set ip addr of dns server in resolv(conf file
= vi /etc/resolv(conf
nameserver 9V1(9W>(9(Z
$)% %erver configuration!A
#n dns server the only change is in forward lookup 'one file!A
add following entry!A
friendyogi@gmail.com
Linux Complete Notes 2/74
#) 4Z N mail(cms(com(AAAA(to define mail server
9V1(9W>(9(Z #) & mail(cms(com(AAAA(to define its ip addr
now start mailing from one user to other
root user is mailing to user9!A
= mail user9
%ub6et! hi
skld6fBlas6kdf
lk6dslkaf6aBsld6kf
these are the contents of mail
type it and then press ctrlCd
/c! (press enter
mail is sent to user9
how to check mail!
Login as different user, user9
M mutt (press enter
or
M mail (press enter
.ow to configure sFuirrel mail( graphical mode
#nstall following packages!
sFuirrelmailD, dovecotD, phpD, perlD, httpdD, curlD, cyrusAimapdD,
and sendmailD if it is not already installed
Restart following services!
service httpd restart
service dovecot restart
service cyrusAimapd restart
service saslauthd restart
service sendmail restart
Then you can access mail in graphical mode using webmail( mail client
open mo'ila firefox web browser
type following addr
http!//?name of mail server@/webmail
like
http!//mail(rhce(com/webmail
it will ask for username and password
then you can access your mail
friendyogi@gmail.com
Linux Complete Notes 3/74
+EB SERVER8A$ACHE SERVER9
There are many web servers like ##%(windows, apache, sunone, &OL, etc
most popular web server is &pache, it works on both windows and linux
more than W>L of total web servers of world are configured on &pache
)ote!A go to www(netcraft(com
type url of any web server, and search, it will show you
on what kind of server that web site is working,
like www(way1sms(com is working on &pache 1(: installed on [edora>
go to ip1location(com
type url of any web server, and search, it will show you
the geographical location of that web server,
like www(google(com is in +%, /alifornia, street((((, contact person(((
www(whois(net(((((( you can find who is maintaining that server,
complete contact information is displayed with ph( no( too
use nslookup command to see ip addr of any dns server(
.ow to configure web server!A
packages httpdD(httpd,httpdAmanaul,httpdAdevel
port no( >:
conf file /etc/httpd/conf/httpd(conf
service httpd
daemon httpd
steps to configure web server!A
install the packages if not already installed!A
= yum install httpdD
open main configuration file!A
= vi /etc/httpd/conf/httpd(conf
modify following lines!A
1N: %erver&dmin root8web(cms(com
1WK %erver)ame www(cms(com(!>:
1>: $ocumentRoot S/var/www/htmlS
90K Listen >:
0V: $irectory#ndex index(html
line 1N: is for providing contact user information
if your web server is not working then client will contact to
this person
line 1WK is for provding url for your web site, it may be different from your system
name
like here system name is web(cms(com
but website url is www(cms(com(
and it works on port no( >:
line 1>: is for defining $ocumentRoot
this is the location where your html files are kept
you can change this location
90K Listen >:
this is to define portno( that this web server listens
0V: $irectory#ndex describes the name of first page of your website
if first page name is different then change this option, by
friendyogi@gmail.com
Linux Complete Notes 4/74
default it is index(html file which is created inside
/var/www/html($ocumentRoot
after editing configuration file you have to create website(index page
= cd /var/www/html
= vi index(html
?html@
?title@ This is cms(com web site ?/title@
?body@ ?h9@ This is home page of cms computers ltd( ?/h9@
?hY@ This page is created by _O+R)&4J ?/hY@
?/body@
?/html@
now restart the service
= service httpd restart
now specify your dns server!
= vi /etc/resolv(conf
nameserver 9V1(9W>(9(Z
check it
= dig Ax 9V1(9W>(9(Z
$)% server side configuration!A
on the dns server there is only one change
open [La file and add the entry of web serverB
web(cms(com( #) & 9V1(9W>(9(_AAAAto define webserver
www(cms(com( #) /)&4J web(cms(com(AAAto define its aliasname
= service named restart
/lient side configuration!A
define your preferred dns!A
= vi /etc/resolv(conf
nameserver 9V1(9W>(9(Z
now open web browser and open website www(cms(com or web(cms(com
friendyogi@gmail.com
Linux Complete Notes 5/74
$R%7Y SERVER
-roxy server is used to provide following three services!
/aching %erver
%ecuring web access
#nternet connection sharing
.ow to configure -roxy server!A
package sFuidD
portno( 091>
conf file /etc/sFuid/sFuid(conf
service sFuid
daemon sFuid
%erver side configuration!
#nstall the package!
= yum install sFuidD
Open main configuration file!
= vi /etc/sFuid/sFuid(conf
line no(
Y0 http]port 091>
remove the hash from line no( VV0
cache]dir ufs /var/spool/sFuid 9:: 9W 1NW
define acl before line no( 10VK
like
acl neighbors src 9V1(9W>(9:(:/1K
acl denydomain dstdomain (yahoo(com
acl denykeyword url]regex http!//www(google(co(in
after defining all acl define allow/deny policy for each of them
below line no( 1N::
like
http]access deny denydomain
http]access deny denykeyword
or
http]access deny denydomain denykeyword
http]access allow neighbors
save U exit
restart the service
= service sFuid restart
/lient side configuration!
open mo'illa fire fox
editA@ pref A@ connections A@ manual proxy A@
ip addr of proxy server and port no((091>
use same proxy server for all services
friendyogi@gmail.com
Linux Complete Notes /74
close
try to access different web sites(((((((
or for text mode
open elinks
press escape
go to setup menu
options manager
select protocols(press space to expand
select http (press space to expand
select proxy configuration(press space to expand
select host and portAnumber option and edit
now specify ip addr of proxy server and portno(
save and exit
for windows clients!
open internet explorer
toolsA@ internet optionsA@ connections A@ lan connections A@
specify proxy server2s ip addr and portno
friendyogi@gmail.com
Linux Complete Notes 7/74
&IS33333 &e'o!( In)o!maion Se!vices
#t is a centrali'ed directory service through which we can share
resources like users, groups, mails over the network
#t is similar to L$&-( Light 5eight $irectory &ccess -rotocol
Linux machine uses )#%, %olaris machine also uses )#%C
.ow to configure )#% serverE
packages ypserveD, ypbindD, ypAtoolsD
ypserve is for )#% server only, not client side
ypbind and ypAtools are reFuired on client side
ypbind package is used to bind nisAclient with server
portno( randomly assigned by portmap service
to see portno( use commandAAA (rpcinfo Ap
conf file /var/yp/4akefile
/etc/sysconfig/network
service yppasswdd, ypserv, portmap
daemon yppasswdd
steps!A
9 install the package ( remove it if it is already installed
= yum remove ypD
= yum install ypD
1 set nis domain name temporarily
= nisdomainname cms(com
check it
= nisdomainname (press enter
0 set nis domain name permanently
= vi /etc/sysconfig/network
)JT5ORQ#)*Xyes
.O%T)&4JXsysZ(cms(com
)#%$O4&#)Xcms(com
K edit main conf file
= vi /var/yp/4akefile
line no( 10
)O-+%.XTR+J
it means that there is no slave nis server
line no( 9:V
all! passwd group((((((( mail"
list of database which are centrali'ed on network
N create master nis server2s database
= /usr/lib/yp/ypinit Am
it will ask hostname! (press ctrl C d
then it will ask (y/n (press y
W create some users!A
= useradd nisuser9
= passwd nisuser9
friendyogi@gmail.com
Linux Complete Notes !/74
Y share your home dir using nfs server!
= vi /etc/exports
/home D(rw,sync
= service nfs restart
= showmount Ae
/onfiguring )#%A/lient!
9 set nisdomain name
= nisdomainname cms(com
= vi /etc/sysconfig/network
)#%$O4&#)Xcms(com
1 mount home dir from server over client2s home dir
= mount 9V1(9W>(9(Z!/home /home
0 specify the type of authori'ation!
= authconfigAtui
D nis
ok
K check your nis server connectivity
= ypwhich
it will show nis domain name in output
N logout and login with nisuser9
now whatever data you create on client machine2s home dir
will be stored on nisAserver2s home dir
it means /home dir is centrali'ed
friendyogi@gmail.com
Linux Complete Notes "/74
4IC4START I&STALLATI%&
#t is similar to R#%/+nattended installation of 5indows os
,y using kickstart installation we can install linux on remote machine
all the installation files are present on kickstart server
client is booted from linux bootable cd(cd no(9 and
then it will take installation files from server along with
answer file(
&nswer file is a file generated on kickstart server which provides all
answers of Fuestions which are asked during installation process(
ReFuirements for kickstart server!A
all the files of R.JL cd/dvd
dhcp server
kickstart answer file
nfs/ftp server
ReFuirements for kickstart client!A
first cd/dvd of R.JL
.ow to configure kickstart server!A
first configure your system as dhcp server, providing valid ip addr range
method 9!A
if we are using N cds then, copy all the contents of 9st cd to
/var/ftp/pub
then copy contents of %erver dir of remaining cds to /var/ftp/pub/%erver
method 1!A
if we are using 9dvd then simply copy complete dvd to /var/ftp/pub
now configure nfs server to share this location
= vi /etc/exports
/var/ftp/pub D(rw,sync
= service nfs restart
check it
= showmount Ae
or
now configure ftp server to share this location
6ust install the vsftpd package and configuration is completed
because by default ftp server shares /var/ftp/pub location itself
= service vsftpd restart
now create kickstart file!A
for this we need a package systemAconfigAkickstart
if this package is not installed then install it first form cd/dvd/yum
then
= systemAconfigAkickstart(press enter
it will open a wi'ard
configure the options,
after configuring options you have to add package list manually to the
kickstart file
give following command!A
= yum grouplist @@ /var/ftp/pub/ks(cfg
it will transfer all group names to end of kickstart file
friendyogi@gmail.com
Linux Complete Notes 7#/74
now modify that file
= vi /var/ftp/pub/ks(cfg
at the bottom write
Lpackages
8 editors
8 bava $evelopment
((((
((((
then save the file
give executable permission to this file!A
= chmod Cx /var/ftp/pub/ks(cfg
so that any client can execute this file when needed
.ow to configure kickstart client!A
boot the system by using 9cd
you will get boot prompt
boot!
here you can use any method nfs/ftp
boot! linux ksXnfs!9V1(9W>(9(9:!/var/ftp/pub/ks(cfg
or
boot! linux ksXftp!//9V1(9W>(9(9:/pub/ks(cfg
installation starts from server((((((((
Ho' o pe!)o!m ne'o!( insallaion:-
configure nfs/ftp server with dump of all cds in /var/ftp/pub
on the client side boot with cd
boot! linux askmethod
it will ask for type of installation
nfs
ftp
cdrom
choose nfs and specify ip addr of nfs server and dir(/var/ftp/pub
or
choose ftp and specify ip addr of ftp server and dir(/var/ftp/pub
installation starts from server((((((((
friendyogi@gmail.com
Linux Complete Notes 71/74
Vi!uali:aion
Red .at 3irtuali'ation can host multiple guest operating systems(
Jach guest operating system runs in its own domain(
Jach guest operating systems handles its own applications(
3irtuali'ation is of two types!
[ull virtuali'ation or paravirtuali'ation(
[ull virtuali'ation provides total abstraction of the underlying physical system
and creates a new virtual system in which the guest operating systems can run(
)o modifications are needed in the guest O% or application
(the guest O% or application is not aware of the virtuali'ed environment
and runs normally(
-araviruali'ation reFuires user modification of the guest operating systems
that run on the virtual machines(these guest operating systems are aware that
they are running on a virtual machine
The first domain, known as domain: (dom:, is automatically created
when you boot the system( $omain: will host *uest O%($omain9(
The hypervisor (Red .at2s 3irtual 4achine 4onitor is a virtuali'ation platform
that allows multiple operating systems to run on a single host simultaneously
within a full virtuali'ation environment(
& guest is an operating system (O% that runs on a virtual machine in addition to
the host or main O%(
.ardware ReFuirements for 3irtuali'ation!A
#ntel 3TAx or &4$A3 -acifica and 3anderpool technology for full and paravirtuali'ation(
[or full virtuali'ation your system must support -&J(physical &ddress Jxtension,
by using -&J technology we can increase the amount of physical or virtual memory
available to user applications(
/eleron S -entium ## S -entium ### S -entium #3 S Zeon S &4$ &thlon S &4$ $uron
for paravirtuali'ation(
#nstalling virtuali'ation!A
yum install ?package name@
packages are!
kernelAxen
xen
xenAlibs
virtAmanager'
gnomeAappletAvm
libvirt
,ooting a guest domain
we can use virsh or xm commands
friendyogi@gmail.com
Linux Complete Notes 72/74
= xm create Ac guestdomainname
you can make it permanent !
= chkconfig xendomains on
/onnect to a domian!
= xm console domainAid
/reate a domain!
= xm create Ac newdomainname
saving a domain!
= xm save domainAid
destroy a domain!
= xm destroy domainAid
shutdown a domain!
= xm shutdown domainAid
restore a domain!
= xm restore domainAid
suspend a domain!
= xm suspend domainAid
resume a domain!
= xm resume domainAid
reboot a domain!
= xm reboot domainAid
pause a domain!
= xm pause domainAid
unpause a domain!
= xm unpause domainAid
display domain states!
= xm list domainAid
display uptime!
= xm uptime domainAid
display domain information!
= xm domain info
4anaging 3irtual 4achines in *+# mode!
by using 3irtual 4achine 4anager
The 3irtual 4achine 4anager (344 gives you a graphical view of the virtual machines
friendyogi@gmail.com
Linux Complete Notes 73/74
on your system(
_ou can use 344 to define both paraAvirtual and full virtual machines(
Open connection window!
go to applications A@system tools A@ virtual machine manager
select local xen host
click on connect
344 window opens, here you can see domain: is running
.ow to create a new virtual machine!
ReFuirements!
first create a new partition on $omain: host(ex( /dev/hdaV
then configure your nfs install server 9V1(9W>(9(9:(share dir is /var/ftp/pub
then create a kickstart server 9V1(9W>(9(9:(save file in /var/ftp/pub
/lick on new in 344 window
A@forward
A@enter the name of virtual server(remember this name and click forward
A@specify the type of virtuali'ation(paravirtuali'ation and click forward
A@enter install media url(((((((( nfs!9V1(9W>(9(9:!/var/ftp/pub
enter kickstart url((((((((((( nfs!9V1(9W>(9(9:!/var/ftp/pub/ks(cfg
click on forward
A@specify the partition name
partition((((( /dev/hdaV
click on forward
A@set max( memory for virtual machine( don\t modify anything
click on forward
A@start creating virtual machine(((((((((((((
&fter virtual machine is created you can view graphical mode in
3irtual machine console window
to start your guest machine!A
= xm create Ac guestname
then right click on guest in virtual machine manager and chose open to open
virtual console
)ote!A you can also use SvirtAinstallS command to create a virtual machine in
text mode
friendyogi@gmail.com
Linux Complete Notes 74/74
)otes!A
cccccccccccccccccccccccccccccccccccccccccccccccccccccccccc
cccccccccccccccccccccccccccccccccccccccccccccccccccccccccc(
cccccccccccccccccccccccccccccccccccccccccccccccccccccccccc
cccccccccccccccccccccccccccccccccccccccccccccccccccccccccc(
cccccccccccccccccccccccccccccccccccccccccccccccccccccccccc
cccccccccccccccccccccccccccccccccccccccccccccccccccccccccc(
cccccccccccccccccccccccccccccccccccccccccccccccccccccccccc
cccccccccccccccccccccccccccccccccccccccccccccccccccccccccc(
cccccccccccccccccccccccccccccccccccccccccccccccccccccccccc
cccccccccccccccccccccccccccccccccccccccccccccccccccccccccc(
cccccccccccccccccccccccccccccccccccccccccccccccccccccccccc
cccccccccccccccccccccccccccccccccccccccccccccccccccccccccc(
cccccccccccccccccccccccccccccccccccccccccccccccccccccccccc
cccccccccccccccccccccccccccccccccccccccccccccccccccccccccc(
cccccccccccccccccccccccccccccccccccccccccccccccccccccccccc
cccccccccccccccccccccccccccccccccccccccccccccccccccccccccc(
cccccccccccccccccccccccccccccccccccccccccccccccccccccccccc
cccccccccccccccccccccccccccccccccccccccccccccccccccccccccc(
cccccccccccccccccccccccccccccccccccccccccccccccccccccccccc
cccccccccccccccccccccccccccccccccccccccccccccccccccccccccc(
cccccccccccccccccccccccccccccccccccccccccccccccccccccccccc
cccccccccccccccccccccccccccccccccccccccccccccccccccccccccc(
cccccccccccccccccccccccccccccccccccccccccccccccccccccccccc
cccccccccccccccccccccccccccccccccccccccccccccccccccccccccc(
cccccccccccccccccccccccccccccccccccccccccccccccccccccccccc
cccccccccccccccccccccccccccccccccccccccccccccccccccccccccc(
cccccccccccccccccccccccccccccccccccccccccccccccccccccccccc
cccccccccccccccccccccccccccccccccccccccccccccccccccccccccc(
cccccccccccccccccccccccccccccccccccccccccccccccccccccccccc
cccccccccccccccccccccccccccccccccccccccccccccccccccccccccc(
cccccccccccccccccccccccccccccccccccccccccccccccccccccccccc
cccccccccccccccccccccccccccccccccccccccccccccccccccccccccc(
cccccccccccccccccccccccccccccccccccccccccccccccccccccccccc
cccccccccccccccccccccccccccccccccccccccccccccccccccccccccc(
cccccccccccccccccccccccccccccccccccccccccccccccccccccccccc
cccccccccccccccccccccccccccccccccccccccccccccccccccccccccc(
cccccccccccccccccccccccccccccccccccccccccccccccccccccccccc
cccccccccccccccccccccccccccccccccccccccccccccccccccccccccc(
cccccccccccccccccccccccccccccccccccccccccccccccccccccccccc
cccccccccccccccccccccccccccccccccccccccccccccccccccccccccc(
cccccccccccccccccccccccccccccccccccccccccccccccccccccccccc
cccccccccccccccccccccccccccccccccccccccccccccccccccccccccc(
cccccccccccccccccccccccccccccccccccccccccccccccccccccccccc
cccccccccccccccccccccccccccccccccccccccccccccccccccccccccc(
cccccccccccccccccccccccccccccccccccccccccccccccccccccccccc
cccccccccccccccccccccccccccccccccccccccccccccccccccccccccc(
cccccccccccccccccccccccccccccccccccccccccccccccccccccccccc
cccccccccccccccccccccccccccccccccccccccccccccccccccccccccc(
cccccccccccccccccccccccccccccccccccccccccccccccccccccccccc
cccccccccccccccccccccccccccccccccccccccccccccccccccccccccc(
friendyogi@gmail.com

Вам также может понравиться