Sie sind auf Seite 1von 39

35

Red Hat Linux


Helping Commands
# man (Command name) # info (Command name) # (Command name) --help # whatis (Command name) #history (Show the all executable command) #history -c (Clear the all executable command) #history :less (Show the all executable command page wise) #history :more ( It will generate the output of history command page wise) #system_config_language {to change the language} #system-config-display {to change the display} # Ctrl + c {command terminate} #evince {PDF file reader}

Terminal Commands
Alt+Ctrl+f1, Alt+Ctrl+f2, Alt+Ctrl+f3, . . . . ., Alt+Ctrl+f6 (CLI Terminal) {Command line interface} Alt+Ctrl+f7 (GUI Terminal) {graphical user interface} #startx #free #free m {convert CLI to GUI} {to check the ram} {memory check}

File & Directory Commands


#mkdir directory name {make the directory} #rmdir directory name {delete the directory} #rm rf directory name {forcefully Delete the directory } # cat >file name {reate the file} Ctrl+d {Save the file}

35 #cat file name {Read the file} #cat >>file name {Update the file} #rm file name {Delete the file} #touch abc (File name) {create the file} #file abc (File name) {check the file identy} #echo this is the file {make the file} #ls {show the file & Folder} White is file, & blue is folder #ls l {Show the file and type of permission} #ls li file name {Data recover} #ls a {Show the all hidden file and folder} # ls id {Show the information}

Copy & Moving Command


# cp file name(Source) (Destination) #cp rf folder name (Source) (Destination) #cp rvf (file/folder) (Source) (Destionation) #mv file&folder(Source) (Destination)

VI Editor & VIM Editor


vi

Esc

Insert

Command

yy {To Copy} p {To Paste} 10yy {To copy number of line} 3p {To paste number of line} dd {Delete the line} dw {Delete the word} Shift +g {It takes you on the bottom at the file} M {Middle the file} H {Top the file} L {Las of the screen} :date {To print the date} :%s/is/are/g {To change the word (is to are)} Ctrl + U {Undo} Ctrl + R {Undo} :w! {To save the file}

35 :set nu {to set the line no.} :q! {To exit the file without saving} :wq! {To save and exit)} /xyz(name of word) {find the word}

Permission
User authentication information will be stored in 3 file (1) /etc/passwd {user information} (2) /etc/group {group informaiton} (3) /etc/shadow {password is encrypted form} Two type of permission (1) Sybolic (2) Numeric Symbolic :- r = read, w = write, x = execute Numeric :- 4 = read, 2 = write, 1 = execute special r W x w Sp.Permission Owner Group

Other

#mkdir /sale #chmode u+rw /sale {Read and Write permission} #chmode u-w,g+x,o+r /sale {Owner-write, group-execute, other-read} #chmode ugo,wrx {Owner-write, group-read, other-execute} #chmode 741 {Owner-read, group-write, other-execute} #chmode 111 /sale {All execute} #chmode 024 /sale {Owner-no, group-write, other-read} #chown :group /sale {Change the ownership}

Special Permission
(1) If Setting user id 4 then #chmod u+s abc (file name) #chmod 4664 abc (Special per) (user) (group) (2) If Setting group id 2 then (Other) {remove only group} {only owner execute}

35 #chmod g+s abc (File name) #chmod 2664 abc (Special perm) (user) (group) (other) {can not be remove the file}

(3) If Setting Sticky bit id 1 #chmod o+t abc (file name) #chmods 1664 abc (file name)

Umask Value
Root:-022 User:-002 {by default root permission 022} {By default user permission 002}

#umask root]# folder permission =777 File permission =666 User]#default permission umask =effective permission 777 022 = 755 (root Folder permission) 777 002 = 775 (user Folder permission) 666 - 022 = 644 (root File permission) 666 - 002 = 664 (user File permission) #umask 006

Cron (Password Ageing Policy)


By default password do not expire Forcing password to expire is part of a strong security policy (/etc/login To modify password ageing for existing user, use the chage command #chage vikrant {username} #chage E never vikrant {user vikrant age remove} #chage e vikrant {user vikrant age remove} #chage vikrant {user vikrant age} #chage E 10-02.2009 vikrant (user name) nologin #chage E never vikrant (user name) login default)

35

Sticky Bit
In sticky bit whether the folder has the full permission even though users are not suppose to bride the file neither remove. #mkdir /kumar #chmod 777 /kumar/ #chmod 1777 /vk/

{no other user change the directory and file}

ACL (Access Control List)


#cp /etc/fstab /tmp #vi /etc/fstab lable = / / :wq!

ext3

default,acl

#getfacl /tmp/fstab {Check the permission} #setfacl m u:vikrant:rw /tmp/fstab {to give the permission read and write to vikrant }

User & Group Management


#useradd abc (User name) {Create the user} #passwd abc (User name) {Give the user password} #groupadd xyz (Group name) {Create the group} #userdel abc (user name) {Delete the user but not home directory} #userdel r abc (User name) {Delte the user and home directory{Complete}} #groupdel xyz {Delete the group} #usermod g xyz (Group name) abc (User name) {Primary Group} #usermod G xyz (Group name) abc (User name) {Secondary Group} #usermod s abc (user name) /sbin/nologin {abc no login} #usermod s abc (user name) /bin/bash {abc login} #groupmod n xyz(new group name) abc (old group name) #usermod ddd (New group name) xyz (Old group name) {To Change group name} #usermod s /sbin/nologin abc (User name) {User cant be login} #usermod L vikrant (user name) {lock the user} #usermod U vikrant (user name) {unlock the user} #groups {Check the group} #chown -R abc (User name) jkl(File name/directory)

35 #chgrp R abc (User name) jkl(File name/directory) #whoami {check the current user} #who {check the terminal type} #pwd {Check the directory} #id {User Id information} #su vikrant (User name) {To switch the user} #su {To Switch the root} #su l vikrant (User name) {To Switch the user}

Date & Calendar


#date {show the date} #date mmddhhmyy {Change the date} #cal {calender} #cal 08-2008 {show the august 2008 calendar}

Important Directories
/root, /home/usr name {contains the private file and folder of all system users} /usr/bin {contains the all executable programmed to be used by all users} /sbin, /usr/sbin {Contains the programmed meant to be used by system administrator} /media, /mnt {there are the mount point used the device (Cd, Pen Drive)} /etc {contains the all system configuration files} /tmp {this is the folder which is used the temporary file} /boot {this folder contains the booting file which is used by the operating system load it self of memory} /var, /srv {contain the server data} /proc, /sys {contains the system information file which is controlled by the karnal operating system. Is is system information file. } /lib, /user/lib /usr/local.lib {contain the library file} /var/log {contains the all logs of system}

Commands
#command >file name {command output will be defined file} #command 2> file name {command output not error} #command >>file name {append} # find /etc(Path) name passwd(File name) {find the file} #mkdir /abc |cd /bob | touch new | echo this is file>olt.txt | cp old.txt new multiple command}

{used

35

File Editing
#tr a-z A-Z <abc (File name) #sort abc (file name) #sort r abc (File name) #sort n abc (file name) #sort u abc (file name) #wc l abc (file name) #wc w abc (file name) #wc c abc (file name) #head n 5 /etc/passwd #tail n 10 /etc/passwd #grep vikrant /etc/passwd tool} #diff /etc/passwd /passwd #aspell check abc (File name) #aspell list < abc (file name) #sed s/dog/cat/ abc (file name) #sed s/dog/cat/g abc (file name) #evince abc(file name) {small letter to capital letter} {sequence} {sequence opposite} {line} {destroy the double line} {count the all line} {count the all words} {count the all character} {upper 5 line show} {show 10 under line} {searching all vikrant word}{searching {check the file difference} {spelling check} {spelling missing} {change the word (dog to cat)} {change the word globally} {PDF file reader}

Script
#vi h {create a file. And write the all command in this file } #chmod a+x h {change the permission} #./h #cp h /bin {copy file to /bin} #h {run the all command }

Network Configuration
#ifconfig (etho) {view interface configuration Ethernet} #ifup eth0 {enable ethernet} #ifdownl eth0 {disable ethernet} #ethtool_tool {check the link} #mui_tool {check the link} #neat {configure ip address} #neat-tui {configure ip address} #system-config-network {configure ip address} #service network restart {restart the network service} #chkconfig network on {service permanent on} #cd /etc/sysconfig/network-scripts/ {network database}

35 network-scripts]#cp ifcfg-etho ifcfg-eth1 network-scripts]#vi ifcfg-eth1 #vi /etc/sysconfig/network {to change the host name} #vi /etc/hosts #vi /etc/resolv.conf {dns server name & ip address or server ip address}

Network Diagnostic Tools


#ping 192.168.1.3 #traceroute 192.168.1.3 #nslookup 192.168.1.1 {DNS connectivity Server} #dig server@example.com {Host name connectivity} #host 192.168.1.3 {server check the connectivity} #hostname {check the host name} #vi /etc/sysconfig/network {host name entry} Host name = station @ example.com #cat /etc/resolv.conf #vi /etc/hosts {it check and configure the dns ip address} {permanently host entry}

Network Clients
(1) Firefox (2) Evolution (3) links (4)mutt (5)wget {GUI Mode} {GUI Mode & Configure mail} {CLI mode} {CLI mode everything mail configure} {downloading from ftp and http server}

Process
#ps a #ps u (user name) #ps F #pgrep U #pgrep G #pidof bash #kill pid #kill -9 #killall #top {check the process} {check the user process} {print process perentage} {check the root process} {check the group process} {check ID process} {kill the process id} {kill the 9 process} {kill the all process} {show the current process k=kill, q=quit}

35 #gnome-system-monitor and receiving} #ps aux #jobs #fg %jobnum #kill 9 %jobnum {display real time process info media allow sorting, killing, {service user process} {check the process on & stop} {kill the 9 process}

Disk Scheduling
(1) Temporary (2) Permanent (1)temporary : #at time #mkdir /schedule #service ahcpd reload (2)Permanent : #crontab e u abc (User name) * minite #crontab e #crontab l * hour * month * date * day

{edit the time scheduling} {check the time list}

Finding & Processing File


#find / -name abc (File name) #find / -iname abc (File name) #find / -user vikrant (user name) #find / -group xyz (group name) #find / -perm 722 #find / -size 1024k #find / -ctime -10 #find / -mtime -10 #updatedb V #locate new {find the file (abc)} {find the file} {find the all file of vikrant} {find the all group file} {find the permission file} {find the 1024 k file size} {find the 10days file} {find the changing file} {update database} {check the all new file}

Remote Access

35

#Ssh 192.168.0.25 #ssh 192.168.0.25 ifconfig #ssh vikrant@192.168.0.25 #scp r 192.168.0.25:/etc /mnt #scp p 192.168.0.25:/etc /mnt #lastb #last #w #who #whoami

{remote access to user} {remote access to user and network configuration} {vikrant is user. And remote access} {remote access and access copy command} {remote access and access to permission} {last login} {login} {information of user login} {information of user login} {check the current user login}

File Zip & Unzip (Tar ,Gzip &Bzip2)


#du h abc(file name) #tar cvf abc(file name) The abc file name change into abc.tar #gzip abc.tar (file name) The abc.tar file name change into abc.tar.gz #gunzip abc.tar.gz (File name) # tar xvf abc.tar ##tar tvf abc.tar #bzip2 abc.tar {file name} The abc.tar file name change into abc.tar.bz2 #bunzip2 abc.tar.bz2 (File name) {check the file size} {compress the file in tar} {more compress file} unzip the file {unzip the abc.tar file} {show the file and folder} {compress the abc.tar file} {unzip the abc.tar.bz2 file}

Backup & Restore User Data


#dump au f /dev/sda1 (Pen drive) /dev/hda5 (home folder) #dump au f /tmp/backup /dev/hda5 (home folder) #cd /home home]# restore rf /tmp/backup {backup data} {backup data} {restore data}

Mount cd, Pen Drive

35 #mount /dev/cdrom /mnt #mount /dev/cdrom /media #mount /cdrw /mnt # eject #eject t #mount /dev/sd1 /mnt {cd access to mnt folder} {cd access to media folder} {cd access to media folder} {eject the cd from cd rom} {access to cd rom} {if pen driv sd1 then access to mnt}

Hard Disk Information & Partition


# df -h #fdisk -l /dev/hda /dev/hdb /dev/hdc /dev/hdd = primary master = primary slave = secondary master = secondary slave {check the hard disk drive size} {check the hard disk drive partition size} if hard disk is ide

/dev/sda = primary master /dev/sdb = primary slave /dev/sdc = secondary master /dev/sdd = secondary slave Create the normal linux partition #fdisk /dev/had #fdisk /dev/sda p = print the hard disk table n = create the new partition & press enter & +500M {give the size in +M (mb)} t = type of partition 10 = no. of partition 83 = linux partition w = save #partprobe

if hard disk is sata

{if hard drive is ide then use this command} {if hard drive is sata then use this command}

{to active the partition & if this command is not access then you restart the computer}

will

35 #mke2fs j /dev/hda10 {format the partition. You change the hda partition no.} #mkdir /new {create the new directory } #mount /dev/hda10 /new {mount the partition} #vi /etc/fstab {create the permanent entry} /dev/hda10 /new ext3 defaults 00 #mount a {refresh the file}

Remove the Partition


#umount /new {unmount the partition} #vi /etc/fstab/ {remove the entry } #fdisk /dev/had p = print the hard disk table d =delete the partition 10 patition no. {if partition no. is 10} w = save #partprobe {to refresh the hard disk} #mount a {to refresh the file}

Create the LVM (Logical Volume Manager) partition


Create the three lvm partition #fdisk /dev/had #fdisk /dev/sda {if hard drive is ide then use this command} {if hard drive is sata then use this command}

p = print the hard disk table n = create the new partition & press enter & +500M {give the size in +M (mb)} t = type of partition 9 = no. of partition, 10 = no. of partition, 11 = no. of partition 8e = linux partition w = save

35 #partprobe {to active the partition & if this command is not access then you restart the computer} will

#pvcreate /dev/hda9 /dev/hda10 /dev/hda11 {suppose the partition no is 9,10,11} #vgcreate vg1 /dev/hda9 /dev/hda10 /dev/hda11 {create a vg1 volume} #vgchange a y vg1 {active the volume vg1} #lvcreate L +500M n lvm vg1 {create the lvm partition} name #lvscan #mke2fs /dev/vg1/lvm #mkdir /newlvm #vi /etc/fstab /dev/vg1/lvm #lvdisplay #vgdisplay #lvscan /newlvm ext3 lvm {any name} {scan the lvm partition} {format the partition} {create the newlvm directory} defaults {create the permanent entry} 00

{check the lvm partition} {check the vg size} {check the lvm size}

Improve the size


#lvextend -L +100M /dev/vg1/lvm #resize2fs /dev/vg1/lvm {improve the size} {active the partition}

Remove the LVM Partition


#umount /newlvm #vi /etc/fstab/ remove the entry #lvremove /dev/vg1/lvm #vgremove /dev/vg1 #pvremove /dev/had{9,10,11} #fdisk /dev/had d = delete the partition w = save #partprobe {remove the lvm volume} {remove the vg1 volume} {remove the pv volume}

35

Create the Swap Partition


#fdisk /dev/had #fdisk /dev/sda p = print the hard disk table n = create the new partition & press enter & +1024M {give the size in +M (mb)} t = type of partition 10 = no. of partition 82 = no of swap partition type w = save #partprobe {to active the partition & if this command is not access then you restart the computer} #mkswap /dev/hda10 #vi /etc/fstab /dev/hda10 #swapon -a #swapon -s /swap swap defaults will {if hard drive is ide then use this command} {if hard drive is sata then use this command}

{create the permanent entry} 00

{to add all the swap partition and start the partition without restart} {to show the swap partition}

Create the Raid (Redundant Array of Inexpensive Disks)


(1) raid 0 = 2 hdd (1) raid 1 = 2 hdd & more {complete redundancy} (3) raid 5 = 3 hdd & more create the raid partition #fdisk /dev/had #fdisk /dev/sda p = print the hard disk table {if hard drive is ide then use this command} {if hard drive is sata then use this command}

35 n = create the new partition & press enter & +1024M {give the size in +M (mb)} t = type of partition 13 = no. of partition fd = no of raid partition type w = save #partprobe {to active the partition & if this command is not access then you restart the computer} will

#mdadm C {create the raid} #mdadm n /dev/md0 {create the new md0 volume} #mdadm C /dev/md0 l0 n 2 /dev/hda{13,14} {create the hda13 , hda14 volume} #mke2fs j /dev/md0 {format the volumt} #mkdir /raid #vi /etc/fstab /dev/md0 /raid ext3 defaults 00 #cat /proc/mdstat {check the raid partition}

Disk Quota
Write the userquota in home line. #vi /etc/fstab lable =/home /home ext3 #mount o remount /home #mount a #quotacheck cvm /home #edquota u vikrant block 0 soft 30

defaults,userquota

00

{mount the home directory} {refresh the fstab file} {to check the quota} {give the quota} hard 70 inode 0 soft 0 hard 0

(size in kb)7 days store file wq! #quotaon /home #repquota /home #quotaoff /home

maximum file store (number of file)

{user quota on} {check the quota} {off the quota}

35

Booting Sequence
(1)Bios Initialization (2)Boot Loader (3)Kernel Initialization (4)init Start & enter desire into Runlevel (1) Bios Initialization & Boot Loader :- It is a program boot your operating system Grup (Grand unified boot loader) boot/grub/grub.conf ----------- Main Configuration file etc/grub.cong -----------Configuration file

Changing to this file will take effect immediately # vi etc/grub.conf Process =0 (Which operating system first boot) Timeout = 5 (Booting time) Splash image = (hd0,0) (splash.tar.gz) {window screen colour} Hidden Menu = Tittle redhat Boot (hd0,0) Karnal /vmlinux-2.6.18-8.el5 ro root = lable =/ rhgb = quit Initrd /initrd-2.6.18-8.el5.img (2) Karnal Initialization & init start :First process of the system . Init start & enter into a desire a run level (Run Level List) Set of specific Service in call of run level (1) (2) (3) (4) (5) (6) (7) etc/inittab Id = (5) #runlevel 0 = shut down 1 = single user mode 2 = multiuser mode without networking 3 = full multiuser mode with networking 4 = no 5 = GUI mode 6 = restart (Configuration File) {To check the run level}

35

Secure Grub
#grub Grub>md5crypt Password : vikrant Password: vgdghiyty78b67ryjknbgf769uvcg {Copy this encrypted form password} Grub>quit #vi /etc/grub.cong Password --md5 Title vgdghiyty78b67ryjknbgf769uvcg {Paste the password} :wq! #reboot

Karnal Modules
# uname r {Karnal Version} #lsmod {list the module of configuration} #modprobe -r usb_storage {unload the device} #modeprobe usb_storage {load the device} #modinfo {information of karnal} #mkinitrd /boot/initrd (uname-r).img \ $(uname-r) {initd file make to booting file} #cat /proc/cpuinfo {information of device system info} #cat /proc/1/* {cpu information} #cat /proc/partations {hard disk partition information} #cat /proc/meminfo {memory information} #gnome-system-moniter {Monitor Handel} #xinit {graphically mode} #startx {graphically mode}

Services
#service service name start #service service name restart #service service name reload #service service name stop #chkconfig service name on #chkcongi service name off {to start your service} {to restart your service} {reload the service withour stop} {to stop your service} {permanently on your service} {permanently off your service}

35

Package Management
RPM - Red Hat Package Manager #rpm i package name #rpm e package name #rpm ivh package name #rpm qa package name #rpm ql package name #rpm ivh package name --force #rpm U package name #rpm V package name #rpm F package name {package install} {remove the package} {i=install, v=view, h=human right} {check the file} {check the file} {forcefully install} {upgrade the installation} {verification installation} {fresh installation}

YUM (yellow dog update modifire) Server Configuration


Yum server removed the all package dependency #yum install package name #yum remove package name #yum update package name #yum search package name #yum info package name #yum list #yum list:less #yum list installed #yum list available {to install the package} {remove the package} {upgrade the package} {search the package} {package information} {check the all package} {check the all package} {to check the installed package} {to check the available package}

Yum Server Configuration


#mkdir /var/ftp/pub {make the directory}

#mount /dev/cdrom /tmp {mount the red hat dvd to tmp folder} #cd /tmp #ls #cp rvf * /var/ftp/pub OR {copy all file to pub folder or copy Server folder to pub} #cp rvf Server /var/ftp/pub

35

#cd /var/ftp/pub/Server or #cd /Server #rpm ivh createrepo( use tab) {install the createrepo.. rmp} #cd /etc/yum.repos.d #ls #cp rhelde( use tab) my.repo {copy rhelde file to my.repo (any name)} #vi my.repo [server] name = redhat (any name)

baseurl=file:///var/ftp/pub/Server enabled=1 gpgcheck=0 delete any line :wq!


#createrepo..(use tab) v /var/ftp/pub #service yum-updatesd restart #chkconfig yum-updatesd on #yum install vnc* {show the all (2113) packages} {restart the service} {permanently on your service} {install vnc with all dependency }

Configure yum on client side


#cd /etc/yum.repos.d #ls #cp rhel..(use tab) my.repo #vi my.repo [server] name = redhat (any name)

baseurl=ftp://192.168.0.1/var/ftp/pub/Server enabled=1 gpgcheck=0 delete any line :wq!


#yum list #service yum-updatesd restart #chkconfig yum-updatesd on

35

NFS (Network File System) Server


Abbreviation of Network File System, a client/server application designed by Sun Microsystems that allows all network users to access shared files stored on computers of different types. NFS provides access to shared files through an interface called the Virtual File System (VFS) that runs on top of TCP/IP. Users can manipulate shared files as if they were stored locally on the user's own hard disk. With NFS, computers connected to a network operate as clients while accessing remote files, and as servers while providing remote users access to local shared files. The NFS standards are publicly available and widely used.

PORT NO:- 2049


#mkdir /var/ftp/pub #yum install nfs* #vi /etc/exports /var/ftp/pub *(rw,sync) :wq! #service nfs restart #chkconfig nfs on #exportsfs v {sharing data or linux DVD dump} {this is nfs blank file} {* = all sharing or 192.168.1.x(rw,sync)}

or # service portmap restart or # chkconfig portmap on {check the data and show the entry}

[Client site]
#exportsfs v {check the sharing} #show mount e 192.168.1.1 {nfs server ip address} #mount t nfs 192.168.1.1:/var/ftp/pub /mnt {data sharing to mnt folder} #cd /mnt #ls

{Linux installation by nfs server}


Boot the red hat dvd /cd Boot: linux askmethod local cd rom nfs (Enter this) ftp http Static ip or dynamic (DHCP) {write linux askmethod}

35 nfs directory : 192.168.1.1 (Server ip) : /var/ftp/pub

FTP (File Transfer Protocol) Server


An FTP Server is a piece of software that is running on a computer and uses the File Transfer Protocol to store and share files. Remote computers can connect anonymously, if allowed, or with a user name and password in order to download files from this server using a piece of software called a FTP Cliet #yum install vsftpd* #yum y install vsftpd* #vi /etc/vsftpd/vsftpd.conf #mount t nfs 192.168.1.1:var/ftp/pub /mnt { mount the file} #ftp 192.168.1.x {client ip address } Login name : anonymous Password : {password blank} ftp> get file name mget folder name bye {bye = exit to ftp} #getsebool a /grepftp #setsebool P htp_home_dir=1 {to get the file} {to get the complete file and folder}

Samba Server
Samba is based on the common client/server protocol of Server Message Block (SMB) and Common Internet File System (CIFS). Using client software that also supports SMB/ CIFS (for example, most Microsoft Windows products), an end user sends a series of client requests to the Samba server on another computer in order to open that computer's files, access a shared printer, or access other resources. The Samba server on the other computer responds to each client request, either granting or denying access to its shared files and resources. {Samba is used share between window and Linux operating system}

Port No :- 139

35 #yum install samba* #vi /etc/samba/smb.conf {samba configuration file} copy #[my share] these #path = /usr/shadow/shared lines #browsable = yes #valid user = vikrant lalit .. Paste these line and uncomment these line [my share] path = /var/ftp/pub {ant file sharing path} browsable = yes Valid user = vikrant lalit .. {user name} :wq! #smbpasswd a vikrant {give the samba password to sharing} #service smb restart #chkconfig smb on #chcon t samba_share_t /mnt /tmp {sharing file} #smbclient //localhost/mnt U vikrant {which user sharing} #smbclient L //localhost/mnt U vikrant {sharing}

HTTP Server & Apache Server


A protocol used to request and transmit files, especially webpages and webpage components, over the Internet or other computer network. & HTTP - the Hypertext Transfer Protocol - provides a standard for Web browsers and servers to communicate. The definition of HTTP is a technical specification of a network protocol that software must implement. HTTP is an application layer network protocol built on top of TCP. HTTP clients (such as Web browsers) and servers communicate via HTTP request and response messages. The three main HTTP message types are GET, POST, and HEAD. HTTP utilizes TCP port 80 by default, though other ports such as 8080 can alternatively be used.

Port No. :- 80

35

#yum install httpd* #vi /etc/httpd/conf/httpd.conf {configuration file} #<virtual host *:80> #Server admin webmaster@dim #document root /.. copy these line #server name. #</virtual host> Paste these lines and uncomment these lines <virtual host *:80> Server admin webmaster@dim Document root /var/www/html server name www.vks.com </virtual host > :wq! #vi /var/www/html/index.html This is the text file :wq! #vi /etc/hosts 192.168.0.44 #service httpd restart #chkconfig httpd on #elinks www.vks.com {to check the file} www.vks.com {create the index.html file}

{bydefault location}

{with out DNS entry}

[Virtual Hosting]
You can run more then 2 site on a single ip address. #vi /etc/http/conf/httpd.conf Copy these line, line no 972 #(Name Virtual Host)*:80 #<virtual host*:80> #document root /var/www/html #server name www.vks.com #</virtual host>

35

Paste these line (Name Virtual Host)*:80 <virtual host*:80> document root /var/www/virtual server name www.vks.com </virtual host> #cd /var/www/ www]# mkdir virtual www]#cd virtual virtual]#vi index.html this is text file :wq! #vi /etc/hosts 192.168.0.250 www.vks.com 192.168.0.250 www.vikrant.com wq: #service httpd restart or #service httpd reload #chkconfig httpd on {Make the virtual directory} {create the index.html file in virtual folder}

Send Mail

or

MTA(Mail Transfer Agent)

A computer in a network that provides "post office" facilities. It stores incoming mail for distribution to users and forwards outgoing mail through the appropriate channel. The term may refer to just the software that performs this service, which can reside on a machine with other services.

Port No. :- 25
#yum install sendmail* /etc/mail/semdmail.cf {Do not touch this file}

#vi /etc/mail/sendmail.mc Dnl#DAEMON_OPTION (PORT=SMTP,ADDRESS=127.0.0.1) {Line no.-116, uncomment this line & stop the loop back mail (ip) } :wq! #m4 /etc/mail/sendmail.mc >/etc/mail/sendmail.cf {redirect the command}

35 #vi /etc/mail/access Yahoo.com RELAY Example.com REJECT :wq! #vi /etc/aliases root : vikrant lalit : sachin root : prashant :wq! #new aliases {read this file} #service sendmail restart #chkconfig sendmail on #mail vikrant Subject :hi Afdadfa Afgaad {to send the mail user vikrant} {person who should get roots mail} {root mail= vikrant mail} {lalit mail=sachin mail} {root mail = prashant}

(coming & outgoing mail) (reject all mail)

Squid Server
SQUID Serve ris used as a proxy Server & block the site OR SQUID is a webcache and proxy server for Linux and UNIX. It is widely supported by the open source community and is used on most medium to large networks. You may consider installing SQUID if your network:

Has a large amount of Internet users (>=100) Consistently downloads files from remote servers Has a need to control Internet access

All of the above can be accomplished using SQUID. It is highly customizable and, therefore, can be used in many dynamic situations and topologies. You can view the main file for a complete guide of options. I will tell you that the conf file is very long. Editing with vi can take some time if you want to look through all the options

Port No :- 3128

35

#yum install squid* #vi /etc/squid/squid.conf HTTP port 8080 {line no. : -73, by default port no 3128} acl myacl src 192.168.0.22 acl myacl dstdomain google.com http access allow myacl http access deny myacl #service squid restart #chkconfig squid on {line no 2409} or

{allow the acl} {deny the acl}

Clint site
Edit :- Preference :- connection setting http p : - 192.168.0.1 Port :- 8080

DNS (Domain Name System) Server


A dedicated server or a service within a server that provides DNS name resolution in an IP network. It turns names for Web sites and network resources into numeric IP addresses. DNS servers are used in large companies, in all ISPs and within the DNS system in the Internet, a vital service that keeps the Internet working. They are set up by network administrators and typically do not exist in the very small business or home OR The DNS translates Internet domain and host names to IP addresses. DNS automatically converts the names we type in our Web browser address bar to the IP addresses of Web servers hosting those sites. DNS implements a distributed database to store this name and address information for all public hosts on the Internet. DNS assumes IP addresses do not change (are statically assigned rather than dynamically assigned). The DNS database resides on a hierarchy of special database servers. When clients like Web browsers issue requests involving Internet host names, a piece of software called the DNS resolver (usually built into the network operating system) first contacts a DNS server #yum install bind* #yum install caching*

35 #cd /var/named/chroot/etc #cp p named.rfc1912.zone named.conf #vi named.caching.nameserver.conf

{copy named.rfc.. to named.conf}

(Line 14 to 25 copy and paste the line in the end of named.conf) #vi named.conf Option Listen on ports 53 {192.168.1.1:} Quary {localhost(any name)}convert in Zone example.com/In{type master, File forword.Zone Allow update (none)} Zone 1.168.192.in.addr.arprin {type master File reverse zone allow update (none)} :wq! #service named configtest {to check the file} #cd /var/named/chroot/var/named #cp localdomain.zone forword.zone #cp named.local reverse.zone #chgrp named forword.zone {change the group} #chgrp named reverse.zone {change the group} #vi forword.zone local host server.mydomain.com station2.example.com station4.example.com #vi forword.zone local host server.mydomain.com .2 in PTR .4 in PTR #service named restart #chkconfig named on #dig server.example.com #dig x 192.168.1.4 #vim /etc/resolve.conf INA INA

{change local host into server.mydomain.com (dns server machin name)} 192.168.1.2 {client entry} 192.168.1.4

{change local host into server.mydomain.com (dns server machin name)} station2.example.com {2=client ip} station4.example.com {4=client ip}

{hostname entry}

35

TCP Wrappers
TCP wrappers basically used to allow or deny any particular service. #vi /etc/hosts.allow #vi /etc/hosts.deny Vsftpd : ALL EXCEPT example.com {nobody can access my ftp service except members of example.com} All : ALL {all service can not access} Vsftpd : ALL EXCEPT .example.com Except 192.168.0.4 {to particular user}

Log Server
To get the log file generated on client site Server file #vim /etc/sysconfig/syslog Syslogd-option = -m r o :wq! #service syslog restart #chkconfig syslog on {configuration file}

Client Side
#vi /etc/syslog.conf *.* @192.168.0.254 :wq! #yum install dialog* #service syslog restart #chkconfig syslog on #tail f /var/log/secure #tailf /var/log./massages {check the log} {check the log}

35

NIS Client

{Network Information Server}

NIS (Network Information System) is a network naming and administration system for smaller networks that was developed by Sun Microsystems. NIS+ is a later version that provides additional security and other facilities. Using NIS, each host client or server computer in the system has knowledge about the entire system. A user at any host can get access to files or applications on any host in the network with a single user identification and password. NIS is similar to the Internet's domain name system (DNS) but somewhat simpler and designed for a smaller network. It's intended for use on local area networks #authconfig tui NIS next Nis domain : RHCE Nis server name : 192.168.0.254 #vi /etc/auto.master /rhome :wq! /etc/auto.misc

#vi /etc/auto.mics [copy first line and paste anywhere in this file] *rw, -----192.168.0.254:/rhome/& :wq! #service autofs restart #chkconfig autofs on

NIS Server
(a)Configuring the NFS Server
Share vikrant home directory /home *(rw,sync) In /etc/exports #exportfs av {check the sharing} #service portmap restart #service nfslock restart

35 #service nfs restart #chkconfig portmap on #chkconfig nfslock on #chkconfig nfs on

(b) Configure the NIS Server


(1) Install NIS server Package #yum install ypserver* (2) #vi /etc/syconfig/network NIS DOMAIN =NIS-SCHOOL-NETWORK (3) vi /etc/yp.conf Ypserver 127.0.0.1 #service portmap restart #service yppasswd start #service ypserv restart #chkconfig portmap on #chkconfig ypserv on #chkconfig yppasswd on #rpcinfo p localhost (4) Initialize NIS Domain /usr/lib/yp/ypinit m /usr/lib/yp/ypinit s {check the server} {Master Server} {Slave Server}

Now that you have decided on the name of the NIS domain, you will have to use the ypinit command to create the associated authentication file for the domain, you will be prompted for the name of the NIS Server, which in this case is vikrant home. * You will have to delete the /var/yp/NIS-SCHOOL-NETWORK directory and restart portmap. Yppasswd and ypserv before yp be able to do this again successfully. (5) Start the ypbind and ypxfrd Domains (Big Domain) Setsebool P ypxfr-disable-trans=1 # service ypbind restart #service ypxfrd restart #chkconfig all #rpcinfo P localhost {check the server} (6) Adding new NIS Users #useradd g users nisuser/vks (user name) #passwd nisuser vks

35 #cd /var/yp run make To update the information about user You can check to see if the users authentication information has been updated by using the ypmatch command, which should return the users encrypted password string ypmatch nisuser passwd getent passwd nisuser

(c) Configure the NFS Client


#service portmap restart #service netfs restart #service nfslock restart #chkconfig portmap on #chkconfig netfs on #chkconfig nfslock on (1) #mv /home /home.save (move home directory to home.save) #mkdir /home (make the home directory) (2)make sure you can mount vikrants $m/home #mount 192.168.0.253:/home /home/ #umount /home (3) vi /etc/auto.master /home /etc/auto.mics :wq! (4) vi /etc/auto/mics Cp 1st line * -rw,soft,intr 192.168.0.253:/home/& #service autofs restart #chkconfig autofs on (5) authconfig -tui Domain NIS SCHOOL-NETWORK Check /etc/ypconf /etc/sysconfig/network #service portmap restart #service ypbind restart 192.168.0.254

35

Dove Cot
Dovecot is a Mail Delivery Agent, written with security primarily in mind. It supports the major mailbox formats: mbox or Maildir. This section explain how to set it up as an imap or pop3 server. or Dovecot is used to store mail from the sending server POP3 POP3S IMAP Imaps POP :Imap :110 995 143 993 Post office protocol Internet massage access protocol (configuration file) {copy this file and paste and uncomment}

#yum install dovecot* #Vi /etc/dovecot.conf

Protocol = imap,imps,pop3,pop3s Protocol = imap,imaps,pop3,pop3s :wq! #service dovecot restart #chkconfig dovecot on

#mutt f imap//vikrant@servcr.example.com

Certificate Generation
#vi /etc/dovecot.conf Line No.-86 Ssl_key_ =/etc/pk Ssl_cert_ =/etc/pk (configuration file) Copy these lines

Ssl_key_ =/etc/pki/tls/certs/dovecot.pem Ssl_cert_ =/etc/pki/tls/certs/dovecot.pem :wq!

{paste and uncomment}

35

#cd /etc/pki/tls/certs Certs]# make dovecot.pem Country code City Vks.example.com root@server1.example.com #mutt f imap//vikrant@server.example.com

HTTPS
https =443 #yum install mod_ssl* #vi /etc/httpd/conf.d/ssl.conf {configuration file} Nothing to change on the above file #cd /etc/pki/tls/certs #mv local.cert test.cert #make text.cert The opn this site https://<site make>

Kickstart Installation
DHCP NFS :- Kickstart Virtualization :- Xen is needed Kickstart :- ks.efg file will be created STEP (1) Create dump on server in directory /var/ftp/pub/ES5 (2) Configure NFS Server and export /var/ftp/pub/ES5 directory (3) Configure DHCP Server (4) Create Kickstart file named ks.cfg

35

STEP1 :Create dump Copy all file cd/dvd to location /var/ftp/pub/ES5 Move to another terminal by tty2 Change to /var/ftp/pub/ES5 Directory And run the following command to see copying in real-line #cd /var/ftp/pub/ES5 #watch du Move to original terminal by tty1 #cd #unmount /mnt (unmount the cd/dvd from mnt folder ) #eject STEP2:Configure NFS Server #vi /etc/exports /var/ftp/pub/ES5 :wq! *(rw,sync)

#exportfs av (check the file) #service portmap restart #service nfs restart #rpcinfo p {check the server}

Virtualization
ftp 192.168.0.254 ftp>pub >server >mget kernel xe* >mget kernel xen-2.6.10.53 STEP3:Configure DHCP #cp /usr/share/doc/dhcp -3.0.5/dhcp.conf.sample /etc/dhcpd.conf

35 #vi /etc/dhcpd.conf give network range :wq! #service dhcpd restart #chkconfig dhcpd on STEP4:Create Kickstart configuration file in grup #system-config-kickstart Server 192.168.200.1 NFS dir - /var/ftp/pub/ES5 FTP dir - /pub/ES5 Web dir - ---Save into /var/ftp/pub/ES5 #vi /var/ftp/pub/ES5/ks.cfg At the end of this file %packages @everythig Key skip :wq!

192.168.200.0 192.168.200.20 - 192.168.200.50

At Client
Insert cd 1 and boot machine At option write the following command boot: linux ks = nfs:192.168.200.1:/var/ftp/pub/ES5/ks.cfg boot: linux ks = ftp://192.168.200.1/pub/ES5/ks.cfg boot: linux ks = http ://192.168.200.1/

Virtual Machine Manager {XEN}


A family of Linux and Windows server virtualization products from Citrix that uses the 64-bit Xen virtual machine monitor, originally developed by XenSource. Express is a free starter package. The Standard Edition includes multi-server management; the Enterprise Edition provides shared storage, and the Platinum Edition offers dynamic provisioning for datacenters

35 Server for DHCP Ip :- 192.168.200.1 NFS : /var/ftp/pub/ES Directory Nfs : 192.168.200.1: /var/ftp/pub/ES5 Boot machine form xen kernel Login : root Password : ****** STEP 1:Create a partition # fdisk /dev/had p n +700M t 8 83 w #partprobe STEP 2:Set kernel memory #vi /boot/grub/grub.conf Add demo-mem = 256m in following way Kernel : /xen.gz-2.6.18.8.els demo mem=256m STEP 3:Install Xen package #yum install virt-manager* #rpm ivh virt-manager----.rpm STEP4 :Setup Xen in GUI mode Application :- system tool :- virtual machine manager :- local Xen host :- connect :new :- forward :- server name (server 1) :- forward :- Para virtualizes :- forward :- install media url nfs:192.168.200.1:/var/ftp/pub/ES5 :-forward :- normal disk partition choose partition specially create from Xen by brows like /dev/hda8

35

:- forware :- VM max memory : 250 MB :- VM startup memory : 250 MB :- forward :- finish Now installation will start : perform normally after installation run Xen in this way # Xen create server start

Troubleshooting {Single User Mode}


(1) #rm rf /etc/passwd {if remove this file} # cp p /etc/passwd- /etc/passwd {copy passwd- to passwd file} (2) #rm rf /etc/shadow {if remove this file} #cp p /etc/shadow- /etc/shadow {copy shadow- to shadow file} #authconfig-tui [click this] use shadow passed :- next :- finish (3) #chage E 2009-04-5 vikrant {age expire for vikrant account} # chage E 2009-04-5 prashanta {age expire for prashanta account} #chage E never vikrant {age never expire for vikrant account} (4) #usermod L vikrant (user name) #vi /etc/passwd ! vikrant (user name) :wq! #usermod U vikrant #chattr +i /etc/shadow #lsattr /etc/shadow #chttr -i /etc/shadow {lock the vikrant user} {comment the vikrant user for lock} {unlock the user} {for setting read only file} {check the permission} {remove the read only permission file}

35

Kernel Panic Problem


(1) (2) (3) (4)
(1)

Grub Changing Initrd Image Fstab File E2lebel


{link file} {grub file}

#vi /etc/grub.conf #vi /boot/grub/grub.conf Insert cd Boot from cd

boot : linux rescue


next no (network) continue #chroot /mnt/sysimage/ #ls #vi /boot/grub/grub.conf Kernel alt+ctrl+f2 # uname (2)

{check the karnal}

#cd /boot #rm rf initrd-2.6.18.92.e15.img Insert cd Boot from cd

{if delete this file}

boot : linux rescue


next no (network) continue #chroot /mnt/sysimage #mkinitrd /boot/initrd-$(uname -r).img $(uname -r) (3) #vi /etc/fstab {change the root lable (/1)} LABLE=/1 / ext3 default .. .. .. .. .. .. :wq! Insert cd Boot from cd

boot : linux rescue


next no (network) continue

35 #e2label /dev/hda1 #e2label /dev/hda2 .. #mkdir aa #mount /dev/hda5 /aa #cd aa aa]#ls aa]#vi /etc/fstab LABEL=/ / ext3 :wq! #reboot (4) #e2label /dev/hda5 #e2label /dev/hda5 #Insert cd Boot from cd /1

{check the root partition} {make the directory} {if root partition is /dev/hda5} {delete the label /1} default

{change the e2label for hda5}

boot : linux rescue


next no (network) continue #e2label /dev/hda1 #e2label /dev/hda2 . {check the label} #e2label /dev/hda5 / {change the lagel}

Das könnte Ihnen auch gefallen