Monday, December 3, 2012

Basic of redhat



Redhat Enterpriese Linux Server Administration


Session during installation:-
Ctrl+alt+f1→mai n installation in text mode (initial)
Ctrl+alt+f2→ shell  prompt
Ctrl+alt+f3→ driver insert session.
Ctrl+alt+f4→ result or out put session
Ctrl+alt+f5→ file system related massage
Ctrl+alt+f6→ main instalation in gui
Login session:-
Ctrl+alt+f1
Ctrl+alt+f2
Ctrl+alt+f3
Ctrl+alt+f4
Ctrl+alt+f5
Ctrl+alt+f6
Ctrl+alt+f7
(above are 7 session means tty . here 6 is in commadn and no.of 7 is in graphical)

Run level :- it is a level which is used to start the pc with specific service. System provide servics according to run level.
Run level 0 →shutdown
Run level 1→single usermod (all run level will start bt network connectivity will not.)
Run level 2→full multiuser mode without nfs
Run level 3→full multiuer mode in text user interface
Run level 4→unused
Run level 5→full multiuser mode in gui
Run level 6→rebootWe can choose or execute run level by
#Init  run level no.
(bydefualt system star ts in 3 or 5 run level)
                       
In place of # if there is $ it shows that it ordinary user.


Dos
Win.sk3
Linux
To install o/s part.
Dos partition
Pri/logcial
Pro./logical
Drive (mount point)
C:/
C:/
Main root part.
File system
Fat16
Fat 32,ntfs
Ext3,ext2
No. Of part.
1,pri
1,extendad
26,logical
4 pri/3pri , 1extendad
&logical
4pri/3pri. 1ext
Upto 63 logical
Virtual memory
not
Auto manage(pagefile.sys
Double of ram swap part.

WINDOWS
LINUX
User friendly o/s
Command line o/s
Graphical user interface
GUI/CLI
Not secure
Secure
.exe
Rpm
Virus attack
Virus free
Vista/2k8
Server/client
Currept
Not currupt

Linux distributer:-
Redhat,fedora,suse,debin,coledra,mandriva,knoppix
Note:- linux needs two partition to install 1, / 2,swap
Virtual memory error display if there is low space virtual memory. To solve this problem delete some data.
Bootinf file→ kernel file
Windows boot loader →ntldr
Linux boot loader→grub/lilo
GRUB= grand unified boot loader
LILO =linux loader
GRUB
LILO
Higher virsion
Lo
/boot/grub
/boot/lilo
Primary/logical
Primary
Any where in HDD
1 to 10 GB HDD
Ssecurity
No
Data recovery easy
No
Presently use
Not in use
 HDD cylender
In 1 GB 121 cylender
Directory structure
/→it store all O/S file and directory
/boot→add bootable file and directories
/dev→store all devices information
/home→store all normal user directiries
/root→it is the directory of super user
/tmp→store all temporary file
/sbin→store all super user command
/bin→store all super and normal user command
/usr→store all help related command
/var→store all variable user
/etc→store all configuration file and directories
/proc→store all runnig and H/W information
/lib→ store all librery file
/mnt
/opt              It’s all use for mounting
/net
/media
/lost+found→ as a recycle bin
Pagefile.sys → virtual memory
HDD sata → /dev/sda
CD –ROM IDE→ /dev/hda
USB  →/dev/sdb
Partition can be
4 primary
3 primary and 1 extended
2 primafry and 1 extended
1 primary and 1 extended
Logical partition get no. 5 bydefault
Exa: /dev/sda5
Installation of linux
If u r installing through network then set first device lan
If u installiing through DVD set first device DVD
 AT BOOT PROMPT
Installation via graphical mode using DVD
Boot:linux text                     Installation via text mode using DVD
To install via dvd:-
Boot:linux askmethod
(at language option)→English→OK→(at keyboard type)US→OK→(select ur installation method if ur installing via dvd then select “local CDROM”)→local CDROM→OK→(now cd found screen appear here u can select if u want to test ur dvd other wise skip)SKIP→OK→next→skip installation no→skip→YES→creat custom layout (if u want to create partition according to ur requirement)→(linux need two partiton  /+swap to install o/s  / part.must be minimum 8GB and swap is double of RAM)→ select new option →select  mount point   /→ file system ext3→part.size in MB (8000)→ok→now select new again and file system swap → define siz swap double  of RAM→next→select add if u r using two o/s on ur pc otherwise select →next→select manuaaly because u r instaling this o/s via dvd→type ur hostname(irfan.com)→next→selct asia/colcutta→ tupe root passwd (redhat)→custom later→next→next→reboot→forward→forward→disable firewall→yes→forward→forward→forward→type user name and passwd →forward→finish.
Installation via graphical mode using 5 type
Alt+f3 =====>to check ip of ur machine and machine which was given by DHCP
Alt+f1=====>to come main window installation window
Ctrl+alt+f2 ===→ to check RAM
To install linux:- there are many optons which helps you to install o/s. These option are avaible if u press f1 , f2 , f3 ,f4 ,f5. If u are using cd type (linux  askmethod) to install ur o/s
Basic command :-
#init 0     (to shutdown)
#init 1      (for single user mode without authentication and without graphical)
#init 2     (for multiuser mode without graphical and NFS)
#init 3     (for multiuser mode with nfs and without graphical)
#init 4     (unsued)
#init 5    (for multiser mode with graphiccal and nfs)
#Init 6     (to restart PC)
# clear           (to clear screen)
#pwd             (print working directory)
#tty    to view  run terminal information
#runlevel                  to view run level information
#ls       (for list of file and directory)
#ls –ld   data (directory and symlink information)
#ls   -al           (deatail of ths command is as follow)
If in place of d there is – it shows file  b=block file  c=charactor
#mount                     it shows file system type,permisstion of mount point
#ls –l (list of file and directory)
#ls –al            (to show hidden file and directories also)
#dir    (list of directory and file)
#date             (to show date and time)
#cal    (to show calender)
#cal 2009 (for what year calender)
#history        (to view all runed command)
#history –c   (to clear history)
#alias (show for all alias )
#alias c =clear          (set alias for any command like c=clear)
Alias means shortckut
#unalias c     (removing for alias)
#bc     (to show calculator)
To come out type quit
#cd /etc         (to change directory)
#cat filename          (for use read file)
head is use to display firtst 10 line
#head  filename
tail is used to display last 10 line
#tail filename
U can also use –n to change number of line display ex:
#tail  -n 3 /etc/passwd (is used to display last 3 line)
#head  -n 3 /etc/passwd (is used to display first 3 line)
Grep also use to view where a pattern is matched
#grep ‘irfan’  /etc/passwd
cut display speciic columns of file
#cut  -d:  -f1 /etc/passwd
wc  (word count ) is use to count word of a  file
#wc  file name
3          8          38       t
(3=line           8=word              38=size)
Switchs which can b use
Use    -l for only line count
User  -w for only word count
Use –c for only byte count
diff is use to compare two file
#diff file1 file2
 Aspell is use to check spelling for file
#aspell check  filename
A quick spelling dictonary look up can be performed with the look  command . it comes in handy when need the spelling of a word fo which u know the firtst few letters
#look exer  (this shows all word which started from exer)  
#runlevel      (for use show user level)
#touch filename     (to create file)
At a time 7 user can login. 6 in command mode and 1 in graphical
GUI to CLI ctrl+alt+f1
#tty    (to check terminal number)
#exit
#logout
#ctrl+d
Above three command use to exit or logout
#whoami      (t o check login user name)
#mkdir  directoryname    (to create a directory)
#cat >> filename    (to write matter in a file)
#mkdir  irfan irfan1 irfan2          (to create multiple directories )
#mkdir  -p  /a1/a2/a3   to create parant directory {ek k under doosri}
To copy:-create a  directory
#mkdir  /irfan
#cp   -rv  /etc  /irfan   to copy etc directory in irfan
-rv   means recursivewith subdirectory also
Move and remame command:-
#mkdir  irfan           to creat a directory
#mv  /etc  /irfan/myetc    (this command will move etc folder in irfan folder with name of myetc)
#touch file1 file2 file3       (to creaat  multiple files)
#mkdir  irfan{1,2}  (create multiple directoires with irfan suffix)
#touch  irfan{1,2}  ((create multiple files with irfan suffix)
#rm file         (to remove filewith confirmatio)
#rmdir  directory name (to remove empty directory only)
#rm  -f  filename     (remove file without confimation)
#cp  oldfile  newfile           (to copy file)
#cp  dir1 dir2           (to copy directory)
Dir1 is source and dir2  is destination
#fdisk   -l       (to information about HDD)
#df   -h                       (to view mounted partition in GB)
#df  -m                      (to view mounted partition in MB)
#du   -sh  file or directoryname  (to check size of file or directory)
To mount pendrive in linux. (pen drive must be format in fat32)
#mount  /dev/sda1  /mnt  (where mnt is a folder whre u want mount pendrive)
To remove mounted pendrive
#umount  /mnt
To mount cd in linux
#mount  /dev/cdrom  /mnt
#cp   -rv Server   /mnt       (to copy server folder in mnt with verbose)
#mv  /imp /mnt/vip           (to move imp directory in mnt from vip name)

 #free  -m      (to check Ram)
#cat  /proc/cpuinfo           (informatio about cpu)
VI stand for visual stand for visual editror.
#vi  filename            (to create a new file or editing existing file)
Insert             (to write in file)
But there are three typs to come in insert mode
Esc i                            to come in insert mode
Esc s                           to delete exist charactor &come in insert mode
Esc a               ona charactor append &come in insert mode
Insert 2time             to replace mode
Esc:set  nu    to set line number
Esc:set  nonu    to remove line number
Esc1yy                       to  copy one line
Esc p               to paste
Esc1cc                        to cut one line
(wher e blink ur cursr it is first line and belove is second and means top to bottom)
Esc1dd                       to delete one line
Esc u               to undo
Esc ctrl+r       to redo
Esc:20                        to go on line no.20
Esc/word      to serch any word
Esc n               t o repeat last found
Esc:%s/oldword/newword         t o replace any word
Esc y1w         to copy one word
Esc c1w                     to cut one word
Esc d1w         to delete one word
Esc:w             to save file
Esc:wq                       to save & exit
Esc:wq                       save and exit
Esc:q              exit
Esc:q!             Save witout save
Esc:wq!                     Save and exit
Esc:w  filename                   to save as
#vim   -x filename   (to protect file by pasawd)
Esc  ctrl+g     to count line no.
Esc/word      to find any word
N         to repeat
Esc  gg                        move cursr on top of the file
Esc  shift+g   move cursur onat bottom  of the file
Esc :line no.  To go specific line no.


Esc x               delete one charactor or
Esc delete key
Esc .                to recall last command
Esc shift+G to go at the end of file
Esc:line no.
To learn more about vi type vimtutor at command prompt.
#hostname newhostname   to set hostname temperary
#vim  /etc/sysconfig/network    to set hostname permanantly
Crontab:-it use for  as a shedule task
#crontab  -l  to show crontab detail
#crontab  -u  root  -l  (to show crontab for root )(whre  -u is for user and root is user name)
#which  commandname   to view command related directory
#crontab  -e    to set crontab
Minute                      hour   date    month                       day     task
0-59               0-23   0-31   0-12               0-7      /bin/mkdir  irfan
0 to 6 (0=Sunday  1=Monday and so on)
#service   crond  restart
#crontab  -r             to remove crontab
Compression:-
Tar                              gzip                            bzip2
Folder/file                file                              file
.tar                             .gz                               .bz2
Very low                   low                             higher
Tar:- it is used to compress file and folder and to take backup for file and folder
At first creat a folder
#mkdir   /irfan
Now copy some data
#cp  -rv  /etc   /irfan
#du  -sh  /irfan                    to view size of irfan folder
#tar  -cvf  filname.tar   source
Where filename.tar is the file where u want to take backup and source is the folder which u want to take backup.
#tar  -cvf  irfan.tar  irfan
Note :- file name must  be in .tar
Where c=create   v=verbose       f=file
Now if delete ur original folder (irfan) u can restore it
#rm   -rf  irfan
#tar  -xvf  irfan.tar
GZIP:- it is in built utility in linux to compress file only not for folder.it is more powerful than tar
#gzip  filename
Ex:
#gzip   irfan.tar
Now  run dir command it will display a file named .gz
#du  -sh irfan.tar.gz
To unzip
#gunzip  filname.gz
#gunzip  irfan.gz
BZIP2:- it is also use for to compress file only. It is more powerful tham tar and gzip
#bzip2    filename
Now  run dir command it will display a file named .bz2
To unzip bz2
#bunzip2  filename           
Disk management:-
#fdisk   -l  to check partition
#fdisk  /dev/sda                  to create new partition(Where /sda is ur HDD controller)
→m                for help
→n                 new partiotion
→d                 for delete
→p                 for print partition
→e                  to create extended partiotion
→l                   to create logical partiotin

 partition no. =3
first cylender value (here enter only)
+size                                        =cylender
+sizeM                                   =megabyte
+sizeK                                    =kilo byte
→+1024M   to create one GB partition
→w                            to save and exit
→q                             to exit without save
Now reboot ur system or run this command
#partprobe              (to reinitialize partition table to kernel)
#mkfs.ext3  /dev/sda3     (to format ur partition) where sda3 is partiotion number
If u want to work in this partiotion u have to mount it
#mount  /dev/sda3   /mnt   (to mount ur partition.where /sda3 is partiotion no. And mnt is a folder where u mounted this partition){but it is temperary mont if u reboot ur system then parttion will not be monted to mount permanant you have to entry in  /etc/fstab   file.}

# mount  -a (to reinitialize filesystem table)
#df   -h  to check mounted partition
But this mount is temparory to mount permanant entry this partiton in fstab file
#vim /etc/fstab
Source
Mount point
Filesystem type
Access mode
f/s option
/dev/sda5
/mnt
Ext3
Defaults


T o delete partiotion:-
At first u have to unmount that partition
#umount  /mnt                   to unmount ur partition
Now run this command
#fdisk   /dev/sda
→d                                         to delete
→3                                         partittion no. Which u want to delete
→w                                        to save and exit
Now restart ur PC or run  #partprobe
LVM   (logical volume manager):-
Perform following four step to resizable partiotion
1 normal partition
2 physical volume
3 volume group
4 logical volume
Step 1:-         create normal partiton
A , create single normal partition (size=2000MB /dev/sda4)
B,  change part. Id 8e (linux lvm. To change id type t.for id list type l)
C, save partition table and run #partprobe
Step2:-                      create physical volume
A, to create physical volume
#pvcreate   <partition no.>
Ex: pvcreate  /dev/sda4
Physical volume /dev/sda4 successfully created
#pvdisplay                to display information about pv
Step3:-                                  create volume group
A, to  vg
#vgcreate  vgname  pvname
Ex: #vgcreate  india  /dev/sda4
Step4:-                      create lv
A, to create lv
#lvcreate  –L  +sizeM  -n  lvname vgname
Ex: #lvcreate  -L  +800M  -n  indore  india
#lvdisplay                             to show information about lv
Now we can format and monut this partition.
Step5:-     now we can extend lv
A, to extend lv
#Lvresize  -L  +sizeM  lvname
# Lvresize   -L  +400M  lvname
Logical volume /dev/india/indore successfully resize 2400M
#lvdisplay                 to show information aboun lv
{#lvextend –L  +500M  lvname   to extend lv size}
{#lvreduce  -L  -300M  lvname  to reduce lv size}
B, if this lv is mounted then we have to run following command to online update LV.
#resize2fs   lvname
#df   -h           to check
Step6:-                      to extend VG
A, repeat step1 and step2
B, to extend partiton
#vgextend  vgname  pvname
#vgdisplay   to information about vg
Removing LVM
Firtst umount  lv
#umount   lvname
#lvremove  lvname   to remove lv
Now remove vg
#vgremove              to remove vg
Then remove pv
#pvremove     to remove pv
Now u can delete normal partition from fdisk command
RAID :- redundent array of inexpensive disk
Simple volume:- one hdd require no faults tolerence.
Spanned volume:-two hdd require and no fault  tolerence becuase if one hdd fail second also fail.
Stripped volume:- (raid 0 ) two hdd require and no faults tolerence provide.
Mirror volume (raid 1) :- 2hdd require 100% fault tolerence.
Stripped set  with parity:- (raid 5) 3hdd require 100% fault tolerence.
Raid :- it is a technology that allw hig level  of storage reliabilty
Ther e are two types of raid
1.software based 1, hardware base

Volume= stripped 0
              =mirrored 1
            =stripe with RAID 5
            Id =fd
#fdisk  -l
#fdisk  /dev/sda
→n     new partition
==:       here enter only
+200M
t           to change id
4          partition no.
Fd       id
P          print the
Make another new partition
With same size and same id
W        to save and exit
Now reboot or run #partprobe
#mdadm  -C  /dev/md0  -l  1 –n 2 /dev/sda{4,5}
Where
Mdadm=for create vome,  -C=create,  -l=level raid,  1=mirrored,  md0=to create one part. From two, 2=part.no,  /dev/sda{4,5}=partition no.
This command use to create a volume like mirror or striped etc.
#watch   cat  /proc/mdstat  to check raid process
Ctrl+c             to exit from this
#mkfs.ext3  /dev/md0      (format md0 is also formatted both parttition)
#mount   /dev/md0  /mnt           to mount
#df  -h                        to check
#cd  /mnt
#mkdir   1{irfan,raja,irfanu}
#ls
#cd  /
Now if u fail or remove one partition then we will get data from another part.
#mdadm  --manage  /dev/md0  --fail  /dev/sda4
#watch cat  /proc/mdstat
#cd  /mnt
#ls
If u want to add new partition and if u want mirrer it then
#mdadm  -S  /dev/md0                to stop raid service
#mdadm  --manage  /dev/md0  --add   /dev/sda6   to add part.in raid md0
#mdadm  --manage /devmd0  --remove  /dev/sda4           to remove part. Frome raid md0
If u want to remove part. Then u have unmount it and then delete from fdisk.
Network configuration:-
#/sbin/ip a  (to view all active devices)
Link command is user to web browser
#links http://www.redhat.com (it is use when ping command is blocked or u don,t  remember full path of url)
#ifconfig       to view ip add. Subnetmask,mac,
#ifconfig  eth0         to view detail about only eth0
#ifdown  eth0         to down eth0
#ifup   eth0  to up eth0
#route   -n    to view gateway
#neat-tui       to change ip subnetmask gateway
#service network restart to active new ip setting
#ping  1.1.1.1 for check conectivity
#mii-tool       to check network cable
#ethtool  eth0         to check cable link
#cd  /etc/sysconfig/network-scripts/iftab           this file store all network setting
#ls
#vim   /ifcfg-eth0   user for change setting of network then save and exit
#system-config-network to change ip setting
#setup                       it is also use to chang network
#hostname   to view hostname
#hostname  irfan.com      to change hostname
#system-config-network-tui       to change tcp/ip  setting
#service network restart to take effect of new setting
#service network status               to check status of service
To make multiple interface permanantly:-
#System-config-network-tui →(add new device and set name ex: eth0:1 and set ipadd.and subnetmask)
#nslookup  station22.example.com     to query with dns via hostname
#nslookup  172.24.254.254                     to query with dns via ip add.
#vim /etc/sysconfig/network-scripts/ifcfg-eth0                   to set permanent ip add. Then run #servicce network restart.
Passwd breaking:- press  up and down arrow key to select which entry is highlited(at red screen).press ‘e’ on redhat linux server. Select following line
Kernel /boot/vmlinuz-2.6.18-128.el5 ro root=LABEL=/ rhgp quiet
And press ‘e’  →press space buton →type 1 or s to start pc with single user mode →press ‘b’ to pc→
Sh-3.2#passwd root          (type new root passwd and start pc with runlevel 3)
User management:-
Follwing file are able to save user’s information
# vim /etc/shaow
#vim  /etc/passwd
#vim  /etc/group
User’s defaults home directory will be “/home/user’s name
Ex: for user irfan   =/home /irfan
#vim  /etc/shadow (this file store the user’s passwd & accout passwd aging information)
#vim  /etc/passwd (this file store’s the user id no.home directory group id no.and shell prompt information)
#vim  /etc/group  (this file store on ly group related information)
#vim   /etc/login.defs  (to set default passwd and account policy for user and group)
#vim  /etc/default/useradd         (to change home directory for user)
#chmod  usernmae (to change user accout and passwd age)
#chage   -l username (to check list)
#adduser  username   OR  # useradd username  to add new user
#passwd username           to set passwd for user
Note:- if u don’t type username it will change root passwd.
#usermod  -L username  to lock user
#usermod  -U username              to unlock user
#cat  /etc/shell                    to use only show shells
/bin/sh        = system use
/bin/bash  =for user
/sbin/nologin= for no login user
#chsh   -s  /sbin/nologin  username      to change shell for user . now user will not login.
#chsh   -s  /bin/bash      username         to change shell for user . now user will login.
Note:- if u will not type username it will change shell for root.
#groups        to view group
#groupadd   groupname                          to add group
Group level
Primary group:-  -g   single
Secondary groups:-   -G  multiple
#adduser  -g  groupname username    to add new user in existing group.
#adduser  -g primary group name  -G secondary group name username (to add new user in existin mutipl groups)
#groups   usernme to check users groups
#usermod  -g  groupname username   to add existing user in existing group.
#usermod  -g  primarygroupname –G secondarygroupname username          (to add existing user in existing multiple group)
#groupdel   groupname  to delete group
#userdel  -r  username                 to delete user
(if   -r will not use it then will user’s home directory will not remove)
#usermod  -G group1 group2  username                   to add existing user in multipe exsitting groups
#passwd  -d  username                to remove login time passwd
#Id      to view root id  (root defatult id is zero)
#id  username         to view user id
User permission:-
These all tasks will be in /
#mkdir   /data
#ls  -ld  /data            to view permission on data folder
#groupadd  india    add a new group
#adduser  -g india a1 (a1 is user name)to add a user in india group
#adduser  a2           to add a new user
Set a1 and a2 user passwd
#  india data to change group
#chmod  775 /data            to set permission on data folder
(here 7=owner,  7=group,  5=other)
7=root,                      7=groupmember  a1                     5=other  a2
#ls  -ld  data             to check permission
Drwx rwx r-x           2          root    root    4090
here
rwx=owner  rwx=group    r-x=other     2=no.of content         root=owner       root=group    4090=size
                    owner                                                     groupmember                      other

r =read                      4                                                          4                                              4                                                         
w=write        2                                                          2                                              0         
e=execute     1                                                          1                                              1
4=read                      2=write                     1=execute
775 permission on data folder means
Owner=full  groupmem.=full                 other=read+execute
Now login from a1&a2 user and run  #cd   /data  command.a1 user can save file and directory but a2 user can not save file or directory.
#chown  username  data to change owner of data folder(creat a user setpasswd &run this command. Only root can change owner of file and folder.)
If we want to set special permission for a perticular user in india group then run following command
#setfacl  -m  u:username:rwx /data (here m=manage,    u=user)(permission will be type ex: r-w )
#ls  -ld /data username
#getfacl  data
Above both r use to check permission
#setfacl  -x u:username:rwx  file /folsder name (to romeveacl)
#setfacl  -x g:groupname:rwx  file/folder  (to set facl for group)
#chmod 775 data –R                    to set permission for data subfolder also.
Special permission (sticky bit and SGID)
SGID =special  Groups ID
Sticky bit protect file and folder from deleting by members . and sgid set special group stamp on file created by different group members. Setting sticky bit..
#chmod  o+t data  it will assign t or T in place of in place of x
#chmod  o+s  data it will assign s or S in place of in place of x
                                    ************
Changing permission – symbolic method:-
chmod command is use  to change access modes
WHO MAY BE
OPERATER MAY BE
PERMISSION MAY BE
u=user who owns the file
+ add a permission
r=read
g=user’s in the file groups
-                     Remove permission
w=write
O=other users
= assign a permission
X=execute or cd
a=all three categaries

S =set user id bir or group


T=sticky bit (for directory)
Ex:
#chmod ugo+r  filename (grant read access to all for file)
#chmod o-wx  directory  (deny write and execute to other for directory)
#chmod  u+w,go-w filename (grant write access to owner but denies it to group and other)
#chmod  --reference file1 file2 (get the mode from file1 and place it on file2)

VNC :-
used to manage computer remote location by graphical prompt.
It is virtual network computer.
#yum install rdesktop*
#yum install vnc*
Configuration open graphical mode.(init 5)
Login by root then
System→preferences→remote desktop→
al
low other users to view your desktop→
allow other user to control your desktop
\
Client end
#yum install vnc*
(open graphical mode .login by root )
Application→accessories→vnc viewer→ip &passwd.
Troubleshouting:-
#runlevel      (to check our runlevel)
#vim  /etc/inittab
Id:5:initdefaullt  (if we  want to change our default run level then we can 1,2,3,4, in place of 5. In this file in below there are avalable. Here we can increase or decrease terminal no.but we can extend only 11 command prompt terminal and 1 graphcal terminal . because there are only 12 function key are available on keybaord.)
If our system is in command mode and we want to come in graphical then type
#startx                       or
 #X                  or
#init 5           
If we create a partition and mount it then we have to entry in fstab file.suppose we creat a new parttion named /dev/sda5  mount it in /mnt folder but it is temparary mount to mont permanantly we have to entry in fstab file
#fdisk /dev/sda
N
Entr only
+500M
W
Reboot ur pc or run partprobe
#mkfs.ext3  /dev/sda5
#mount  /dev/sda5 /mnt
#df  -h                        to check mounted partition
But it is temporary mount to mount permanantly entry in fstab file.
#vim  /etc/fstab
/dev/sda5     /mnt               ext3                defaults                     0 0
:wq!
#mount
In this file if type 1 2 or 1 1 in place of 0 0 then if we reboot our system then system will not boot and ctrl d error will display.or if there is entry of any partition but you have delete it by fdisk command then ctrl d error also appear.
To solve this problem:-
Type root passwd→(now computer will be in repair file system mode here if u want to change in
#vim /etc/fstab file changes will not save becase here permission is only read only.now we have to run remount and read write permission command. )
#mount   -o remunt,rw  /
And now run
#vim /etc/fstab                   (now delete that line in which u have entry 1 1 or 1 2 or delete partotin but line is exist.). ifu dont want to remove ur partiton then create a partition.
SOME CONFIGURATION IN FILES:-
Note:- To take effect all these file u have to logout and login again
#vim  /etc/issue                              to set prelogin massage
#vim /etc/motd                              to set after login massage
#vim /etc/DIR_COLORS               to change default files and foldre colors.
1 #vim  /etc/grub.conf    OR
2 #vim /boot/grub/grub.conf
Above 1 2 command’s files are title files. These files are use to change booting o/s if ur pc is loaded from two o/s defaults time out and mimu option.
#vim /etc/inittab    to change default runlevel an and use to extend terminal

(here change only initdefaults no.)
To extend virtual terminal no.
1:2345:respawn:/sbin/mingetty tty1
(copy above line and paste at end and change serial no.)
#vim /etc/profile    to change history size
(don’t make changes in this file except HISTSIZE      )
The command history will be in
#vim /root/.bash_history
#vim /etc/bashrc    to start any programe automatically when user login on the sytem(startup file)
To set any progrma:-  open above file and come in insert mode
mkdir   /irfan
:wq!
Logout and login again. It will creat /irfan folder  automatically.
Alias :- to set shortname or shortcut for any command
#alias c=clear
#alias h=history
When u will type c and press enter clear command will berun. But it is temperary.to set permanant open
#vim /etc/bashrc
alias  c=clear
:wq!
Then logout and login again.alias has set permanant.
#alias                         to check alias
#unalias c     to remove alias
RPM  {redhat package manager}
Insert linux dvd in dvd drive
#dmesg | grep “CD”          to know about  cd/dvd
#mount /dev/sdc  /media To mount dvd(sdc is ur dvd controller)
#cd   /media             to come in dvd mount folder
#cd  Server   to come in Server folder
#rpm  -ivh packagename             to install package
(i=install  v=verbose  h=print the hash% bar progress bar)
#rpm  -qa   packagname   to query about package (q=query   a =all package list)
#rpm  -e packagname   to erase package  (-e=erase)
#umount /media   (to unmount media because to eject ur dvd first u have to unmout  dvd)
#eject    OR   #eject  -t       (to eject ur dvd)
Shell scripts:- (file extension must be .sh)
To create shell scripts
#vim  filename.sh
#vim  backup.sh
Come in insert mode
mkdir /irfan
cp   -rv  /etc  /irfan
:wq!
To run scripts
#sh filenme.sh
Swap partition:- if we want to extend vurtual memory we have to add a new partirtion and format by swap filesystem then enable swapping.
Step:-1
Creat a normal partition.
Change the system id 82=linux swap
Save the partition and partprobe
Step:-2 to format part. By swap
#mkswap  -v1 partition no.         (v1= version one
Step:-3  enable swapping on partiton
Put entry in fstab
#vim  /etc/fstab                  (insert mode)
/dev/sda5     /swap                        swap  default                       0 0
:wq!
Then run following command
#swapon   partition no.
T o enable swaping in partition
#mount –a               To load new setting from /etc/fstab file
#swapon  -s                         to check status
To remove swap partition:-
Remove entry from   /etc/fstab
Then run following command
#swapoff  partion no.
QUOTA MANAGEMENT:-
To apply quota on the partition:-
That parttion must be mounted in userquota mode
That partition must be user writable
To mount partition in userquota mode
#vim /etc/fstab
Linux provid two types of login screen
1                   command 2 graphical
default graphcal environment called GNOME.
To switch from virtual consle to grapical console type ctrl+alt+f7
Changing ur paassswd:=
GUI:- system→preferences→about me and the click CHANGE PASSWD
CLI:- passwd
The root  user:-a special adminnistrative account.also called super user.
Root has all complete over the system.
#su  -username (switch user)
#id username (to view user id)
Tab is very useful option in linux. U can use tab key to complete ur commacd
Suppose u create a a file named myfile
#touch myfile
If u type 
#ls myftab
It  will open myfile.
Use the up and down keys to scroll through previous
Type ctrl+r  to search for a command in commadnd history
Nano is text file editor to creat a file
#nano  filename
Nano is easiest editor t learn. It use ctrl key use it. Two line display it’s menu.for ex: if u want to exit frome file press ctrl+x
#passwd username (this command is use to change user passwd.)
You can run seperate multipl e command on the same line with semicolons.when the firtst command finishes the next will be execute. For ex:
#mkdir  irfan;  cp irfanfile irfan (it will creat a directory irfan and will copy irfanfile in irfan directory.ensure  that irfanfile created file.)
Geting help:- do not try to memorize everything.
Linux provide many level of help
1 man commandname
2                   info commandname
3                   command name  -- help
(t o quit press q)
Whatis command name (short description of commad sometimes it is not avalable after fresjh installation so  u have to creat it ot create whatis run this  command
# makewhatis )
In info command u can use following switches
n/p/u/1 goes to the /next/previous/up-one/last node
linux help guide available at follpwing path
system→documentation→deployment Guide.
Linux are case censative. Directory names may be up to 255 charactors.all charactors are valid except the forward slash.


#vim /var/named/reverse.zone

#service named restart
#nslookup server.jagdamba.com
# nslookup 172.16.172.16
#dig jagdamba.com
(for more detail)
#dig –x 172.16.172.16



8.1.0
http_access allow ournetwork
(on line no.903 by default http port is enable)
(on line no. 1576 set cache memory so remove # & set of ram)
Cache_mem 256 MB
(on line no. 1783 enable cache directory and size for storing web sites)
Cache_dir ufs /var/spool/squid 100 16 256
(On line no. 1945 access log is enable by default)
(on line no. 4148 insert new line and set dns server address)
dns_nameserver 202.56.224.153
(save and exit) restart squid

Client end
At client end oper internet browser and enable connection via proxy.
In internet explorer
Tools>internet options> connections> lan settings>proxy configuration.
(define proxy server ip address and port no. 3128)



No comments:

Post a Comment