Linux
Linux
RAHULGUPTA
[ REDHATLINUXRHEL5SERVER ]
INTHISFILEIWILLTELLYOUALLABOUTLINUXBASICCOMMANDSANDSERVERS 1
INDEX
6.
Hi storyo f Linu x
In1969,FourprogrammerKenThompson,DennisRitchie,RuddCanady&DougMcElroymadea programinBelllabswhichdoesnothaveanynameinyear1969. Brian Kernighan checked that program & found it is very good so]ware for client & networking purpose.HegavethenameUnixtothisprogramon1stJanuary1970(epochbme).FirstOperabngSystem. ThatbmethatprogramwaswrideninAssemblylanguage. In1972,aprogrammerDennisRitchiestartedconverbngthisprograminClanguage.(Alsocalled founderofClanguage). 1973UnixinClanguage. 1980 Berkeley So]ware Development (a part of research program of Berkeley University) launchesopenBSD(asmallprogramwrideninasingleoppy). PaulAllen&BillGatesaretheemployeeofBellLabs. In 1981, they both started Microso] with 9 more candidates & they gave a programme named Xenix(1980)butitwasopped. In1981LaunchedMSDOS1.0 In1984UNIXopensource In1985FirstGraphicalBasedOSWin2.0 In 1991, Linus Benedict Torvalds, Btech Iind year Computer Science, 23 years old student of UniversityofHelensiki(Finland)madeKernel(25thAugust1991). In1994RedHatCompany(collecbonofLinuxSets)cameintoexistence. 96.8%serversofLinuxbll2009.
LINU X PRINCIPLE
1. 2. 3. 4. 5. Everythingisale. Small,singlepurposeprogrammers. AbilitytoChainprogrammerstogethertoperformcomplextasks. Avoidcapbveuserinterfaces. Congurabondatastoredintext.
INSTALLATION
HereIwilltellyouinstallabonrelatedrequirementsandles.(notwholeinstallabon). Linuxusesext2&ext3lesystem. BootloaderoflinuxGRUB(GrantUniedBootLoader)new&LILO(LinuxLoader)old. BootfromCDorDVD Therearemanytypesofmethodofinstallinglinux 1. SimpleGraphicalmethoditwillaskforaEnter 2. Textbased inthisyouhavetowritelinuxtextorlinuxaskmethod(fromthisyoucanalso installfromNFS) MinimumrequirementforGraphicalinstallabonx86processor,256MBRAM. ParbbonCreatedatthebmeofinstallabon Partition Name File System Used for Minimu m Siz e / ext3 linuxlesystem 6000MBor6GB /boot ext3 Linuxboobngles&kernel 75or100MB /home ext3 Linuxusersentry Itsuponyou /swap Swap Usesasvirtualram DoubleofRAM Linuxcansupportmaximum63harddiskIDE&15SATAHarddisk. InLinux7userscanloginatthesamebme. IstUser Atl+Ctrl+F1 nd th II toVI user Alt+Ctrl+F2toF6 Graphicaluser Alt+Ctrl+F7
LINUXBOOTPROCESS
Directorycommands:
1. 2. 3. 4. #mkdir #cd #cd.. #rmdir Forcreabngdirectory. changedirectory. tocomeoutfromworkingdirectory. toremovedirectory
FileCommands:
1. 2. 3. 4. 5. #touch<lename> #cat>lename #cat #catle1>>le2 #catnlename createsablankle. createsaleandforsavingthisle(ctrl+D) toseethecontentofthele. tomovele1maderinle2 toseehowmanylinesarewrideninthatle.
Commandsfordeleb ng:
1. 2. 3. 4. #rmlename #rmi #rmr #rmf deletesale. deletesle/folderininteracbvemode(askingmode) deletesdirectory. deletesles/foldersforcefully.
HelpCommands:
1. 2. 3. 4. 5. 6. #whabs<command> #man<command> #info<command> #<command>help #which<command> #cd/usr/share/doc Theseallarethehelpcommands.Printsallrelatedtags aboutthatcommand.
Rename&Move:
1. #mv<oldle><newle> 2. #mv<lename><wherewehavetomovethele> (Rename) (Move)
Lisb ngCommands:
1. 2. 3. 4. 5. #ls #lsl(ll) #lsa #ls??? #lsm* lisbngles/folders longlisbngofles/folderswithwholeinformabon listsallles/folders(hiddenalso) allles/foldersnamedwith3characters les&directoriesstartedwithlederm.
Copy:
1. 2. 3. 4.
Editorsinlinux:
1. 2. 3. 4. 5. 6. nano vi vim gvim gedit Emacs Theseeditorsareusedinconsolemode.
Theseeditorsareusedingraphicalmode.
VIeditor/VIMeditor: Therearethreemodesinvieditors 1. exmode (defaultmode,bypressingescapekey,thismodeisusedforsavingandexit) 2. Insertmode (bypressinginsertorIkey,thismodeisusedforedibng) 3. Replacemode (thismodeisusedforreplacingtextwriden,byagainpressinginsertorrkey) Forsavingdocumentcomeonescmodeandwrite: w q Forsetnglinenumbersindocumentcomeonescmodeandwrite: se nu Forcomingonanyspeciclinepresslineno.andthenG (ex102thenG) ForgoingattheendofpagepressG Forgoingatthetopofpagepressgg Vimeditorisnotinstalleddefaultwhenyouinstalllinux,youhavetoinstallvimeditor.Itisthe enhancedversionofvieditor. #vim/vilename Pressvtocometovisualmode,herewecanselectthemaderwhichwewanttocopy,pressyy tocopy(ystandsforyank).Pressptopastethatmader. Pressddtodeleteaparbcularlinewherecursoris. NanoEditor: Nanoisacommandbasededitor,earlierusedwhenadvancededitorswerenotcameintobeing. Whenyouopenaalewiththiseditor,youwillndallrelatedhelpofthiscommand.
1. #powerof 2. #haltnp 3. #init0 4. #init6 5. #reboot 6. #startx 7. #init5 8. #history 9. #historyc Switchfromcommandtographic. Restartssystemfromcommandmodetographicmode. Toseehistoryofrecentcommands. Toclearthehistoryofrecentcommands Tocreatelogoscripts. Tocreatelogonscripts. Toseethecalendarofthatmonth&year. Startsbasiccalculator. Toknowbywhichuserweloggedon Tocreateuser Togivepasswordtouser. Tolockauseraccount. Tounlockauseraccount. Toremovepasswordforauser. Switchdirectlytousershomedirectorywith. Toseethetoptenlinesofale. Toseetop16linesofale. Toseethebodomtenlinesofale. Toseebodom16linesofale. Toopenapdfle(onlyongraphicalterminal) Shortleinazformat. Shortleindicbonaryformat. Shortleinzaformat. Translateleinallcapitalleders. Wordcount(lforline,wforword,cforcharacter) ThesecommandsareusedtoRestartcomputer. Thesecommandsareusedtoturnocomputer.
14. #whoiamor#w
15. #adduser<username> 16. #passwd<username> 17. #usermodL<username> 18. #usermodL<username> 19. #passwdd<username> 20. #cd~
21. #head<lename>
24. #tailn16<lename> 25. #evince<lename.pdf> 26. #sort<lename> 27. #sortd<lename> 28. #sortr<lename>
10
31. #dile1le2 32. #blkid Toseedierencebetweensamelookingles. Toseedeviceid(exhda1,sdb). Toformatdeviceinfatformat. Tocheckspellinginale. Toopennetworkcongurabonongraphicterminal TochecktheIP&MACaddressofNIC. ToassigntemporaryIP Toenablenetworkcard. Todisablenetworkcard. ToassignpermanentIP,herewe havetoeditale.
39. #ifdowneth0
40. #vi/etc/syscong/networkscripts/ifcfgeth0
Tocheckgraphicallywhethercableisconnectedornot. Tocheckthefreespaceofaparbbon. Tocheckconnecbvity(c2forseeingtwolines,alisbng) Forlookingtheexactwordspelling. Tosetdate. Tochecktheprocessingstatus. Tokilltheserviceno.9. Fulldetailsofallprocessing&theirID.(kkill,hhelp) Todownloadthewebsitehomepage. Toopenwebsiteincommandline. Startsanewsubterminal. TosendmailinaNISorsinglePCbetweenuser&root Tocheckhowmuchparbbonisused. Itwilllinktheleinhomenamerahulwithrahul(inroot) Itwillcreatealenamedraghavingno.1to1000. Toseekernelname. Kernelrelease. Wholeinformabonaboutkernel. Searcheslein/. Searchesforleshavingpermission775. Searchesforlesof512k
54. #duh<parbbon>
55. #ln/home/rahul/rahul 56. #seq11000>/home/rag 57. #uname 58. #unamer 59. #unamea
11
63. #ndname*.htm 64. #zcat<lename.gz> Searchesleshavingextension.htm. Toseethecontentofcompressle. Toon/oanyservicepermanently. Listofdriversrunning. Detailsaboutrunningdriver Toupdatekernel. Showstemporaryles. Itwilldisplayfullinformabonaboutthatleordirectory. Itwillsetthefulluserpermissiononwwdirectory. TomountCDROM. Tomountanyexternaldevice. Tomountfatparbbon. Todeleteuser. Toaddagroup. Todeletegroup. Toseehistoryofcommands(a]erexecubnghistoryc) Toremovehistoryofcommands Setuserexpirabon. Toseeuserdetailedinformabon. Tosetwarningperiodforuser. Tocheckwhetheritisleorfolder. Itwillshowtherstcolumnofpasswdle. Itwilladdusertogroup. Toseetheidofuser. Toaddnetworkuseringroup. Itwillgivetheoutputofcommandinlenamestages.out. Toseealepagewise. Tondaparbcularwordorstringinale. Toseethelinenumberinwhichthatwordis. Itwilltakethebackupoflesasasinglele. Showhowmanyles&theirnameinthebackuple. Restorethebackup.
70. #ge|acl<lename>
73. #mount/dev/devicename/mnt 74. #mounttvfat/dev/parbbon/mnt 75. #userdel<username> 76. #groupadd<name> 77. #groupdel<name> 78. #cat.bash_history
79. #cat>.bash_history
80. #chageEYYYYMMDD<user> 81. #chagel<username> 82. #chageW1<username> 83. #le<le/directoryname> 84. #cutf1d:/etc/passwd
90. #grep<word><lename>
12
95. #gzip<lename> 96. #bzip2<lename> Itwillcompressale. Itwillcompressale. Itwilldecompressale. Itwilldecompressale. Itwilltakecontrolofremotepc(askforpassword) Tosendanyleinnetwork. Tosendanydirectoryinnetwork. forconverbngext2toext3
PackageNameVersionTypeofExtension
architecture
#rpm<opbons><packagename> #rpmivh<packagename> aid force nodebs (installpackagealongwithdependencies) (forcefully) (toremovepackagealongwithdependencies) (Touninstallpackage) (upgradethepackage) (Showwhetherpackageisinstallornot)
#rpme<packagename> U
#rpmq<packagename> qa qc qd qi qs ql
13
14
r=4(22)
read
w=2(21)
write
x=1(20)
execute
For di rect ory m ax im um pe rm i ssi on=777 For l e sm axi mum permi ssi on=666 To gi ve userfull pe rmi ssi on #chmod777lename Defaul t pe rmi ssi on for l e=644 Defaul t pe rmi ssi on for di re ct ory=755 To see t he i nte rnal pe rm issi on #umask(maxper.umask=defaultpermission) #umask000(fullpermissionforall) #umask777(denyforall) To change the ow ne r of le s or direct ory #chown<username>le/directoryname To change g roup of l es & di rect ory #chgrp<groupname>le/directoryname EveryuserhasitsownUID(UserIdenbcabon) EverygrouphasitsownGID(GroupIdenbcabon) IfUIDmatches(i.e.loginuser&owner)userpermissionisapplicable. IfGIDmatches(i.e.loginuser&group)grouppermissionisapplicable. Ifnothingmatchesotherpermissionisapplicable.
15
Fi le s w he reUI D & GI D i nformab on sav e d /etc/passwd /etc/shadow /etc/group (UID) (UIDinencryptedform) (GID)
/etc/gshadow (GIDinencryptedform)
16
RU NLEV EL(INIT)
Toeditorseeinitlevel #vi/etc/inidab 0=shutdown 1=singleusermode 2=mulbusermodewithoutNFSsupport 3=fullmulbusermode 4=notused 5=Graphical(x11) 6=reboot Ifoursystembootsongraphicalandwewantthatoursystembootoninit3default,wechangethe followingline Id:5:initdefault(herewechange5with3)
CRONTA B
#crontabeuusername */1**** Savele. #servicecrondrestart (nowwhenuserloginon2ndterminalitwillgetmessagehelloa]erevery1min.) #crontabluusername(toseehowmanycrontabarerunningforuser) #crontabruusername(deletesthecrontab) echoHello>/dev/dy2(min,hour,date,month,day)
17
PARTIT IONS
Creabngnew/homeparbbon
#fdiskl (forcheckingtheposibonofharddiskparbbons) #fdisk/dev/hda (toassignwholeharddisk) IDE0 PrimaryMaster hda PrimarySlave hdb IDE1 SecondaryMaster hdc SecondrySlave hdd :n (nforcreabngnewparbbon,enter) Againenter Nowgivethesize(ex10000M) :w (wforsave,dfordelete) #partprobe(orrestart) Nowtoformatthisparbbon #mkfs.ext3/dev/hda7 (whateverparbbonyouhavemade) Nowtomountthisparbbon,makeafolder(ex/home) #mount/dev/hda7/home (butthisistemporarymounbng) Forpermanentmounbng #vi/etc/fstab (nowdothefollowingentryinthele) /dev/hda7 /home ext3 default 12 Savethele. (nowifyouhavepermanentlymountedtheparbbonandnowyouwanttodeleteparbbonrstlyremove theentryfromfstab,otherwiseyoursystemwillbedump)
18
CreabngSwapParbbon
Firstlyifthereisswapparbboninyoursystem,stopswap #freem (tocheckswapisworking) #swapons (tocheckswapisonwhichparbbon)
Parbbonno:5 Hexcode:82(forswap) :w(save) #partprobe #mkswap/dev/hda5 (tomakeparbbonswap) #swapona/dev/hda5 #e2label/dev/hda5hda5swap Nowinfstab LABEL=hda5swap :wq(save) Nowrebootyoursystemandyouwillndanewswapparbbon. swap swap defaults 00 (togivelabeltoparbbon)
19
RAID
Raidareoftwotypes 1. So]wareRaid 2. HardwareRaid Herewewilllearntoimplementso]wareRaid(Raid1,Raid5) MD(Metadisk)(whenmanyharddiskmakesadisk) Firstcreate4(exhad7,8,9,10)parbbonofequalsize. Now, for R aidlevel5 (m inim umt hre e harddi sk) #mdadmC/dev/md0n3/dev/had{8,9,10}l5 raidlevel5) To form at t he m d0 #mkfs.ext3/dev/md0 Now m ountm d0 i n a fol de r #mkdir/raid #mount/dev/md0/raid To chec kt he st at us of rai d de vic e s #mdadmD/dev/md0 #cat/proc/mdstat To m ak e any parb b on fault y #mdadmf/dev/md0/dev/hda10 To rem ove t he parb b on from rai d #mdadmr/dev/md0/dev/hda10 To add new parb b oni n rai d array #mdadma/dev/md0/dev/hda7 (bythiscommandwehavesuccessfullycreated
20
To st op the rai d #mdadmS/dev/md0 Beforestopping,wehavetounmountraid To acb v at e rai d #mdadmA/dev/md0/dev/had{7,8,9} (mountbeforeacbvabng) NowforRAIDlev el1(Mirroring) (minimumtwoharddiskrequired) #mdadmC/dev/md0chunk=64level=1raiddevices=2/dev/had{6,7} Nowformat&mountsameasabove.
(toseewhethervgiscreatedsuccessfully)
21
USERQUOTA
Firstlyeditle/etc/fstabforaddingquotaforusers #vi/etc/fstab LABEL=home Savethele #mountOremount/home #quotacheckcu/home #quotaon/home Now,addtwousersandeditleforuser #edquotauser(editthisle) or #setquotauser5125124050/home Itwillsetquotafortheuserthathecanonlyuse512kbofhomeparbbonspace. #quotao/home (tostopquota) (remounthomeparbbons) (tocheckwhetherquotaisappliedornot) (tostartthequota) /home ext3 defaults,usrquota 00
22
3. #lprm<jobid> 4. #lpq
5. #a2ps 6. #ps2pdf
7. #lpr<lename><Printer>
23
7. #suusername 8. #lsR
(herewecanchangetheOSselecbonbme)
SUDO
Bythiswecangiveuserpermissiontorunaparbcularcommandorcanrunallrootprivilegedcommand. #vi/etc/sudoers (inthislewehavetoeditthele&writetheusernameunderthefollowingline)
## Al l ow root t o runanyc omm andsanyw he re root ALL= (ALL ) use r ALL= (ALL ) ALL ALL
24
25
(savethele)
26
7. Editalenamedrheldebuginfo.repo #v i /et c/ y um. re pos. d/ rhel de bugi nfo. re po (Inthisleenabled&gpgcheckmustbe0) 8. Now,editthisle #v i /et c/ y um. c onf (Herealsoenabled&gpgcheckmustbe0) 9. Now,editlastle #v i /et c/ y um /pl ugi nc onf. d/ rhnpl ug in.c onf (Herealsoenabled&gpgcheckmustbe0) 10. Nowwehavetogrouplestocreaterepodata 11. Installstandaloneservice # rpm iv h /m nt / Se rve r/c re at e re po0 .4.42. fc6. noarc h.rpm 12. #c re at e re pog /m nt / Se rve r/ re podat a/c om psrhel5 serv erc ore. xm l /v ar/ repo/ Serve r 13. #c re at e re pog /m nt /C lust e r/ re podata/c om psrhel5c l ust e r. xm l /v ar/ repo/C l ust e r 14. #c re at e re pog /m nt /C lust e rSt orage / re podata/ c om psrhel5c l uste r st. xm l /v ar/ repo/C l ust e rSt orag e 15. #c re at e re pog /m nt / VT/ re podata/c omps rhel5v t. xml / v ar/ re po/ VT 16. #y umcl e an all 17. #y uml ist all 18. Nowinstallpackagefromcommand #y umi nst al l< pac k ag e nam e> 19. Touninstallpackage #y um re m ov e < pack ag e nam e > 20. Nowongraphicsyouwillndadd/removeprogramandallpackagesaretheretoinstall.
27
#rpmivhSquid2.6.STABLE64.el5.i386.rpm 2. Editle #vi/etc/squid/squid.conf (inthislesetlineno.&remove#anddofollowingchanges) Line no. 73 hdp_port3128 Line no. 993 Cache_dirufs/var/spool/squid10016256
28
Line no. 1079 access_log/var/log/squid/access.logsquid Line no. 1087 Cache_log/var/log/Squid/cache.log Line no. 1097 Cache_store_log/var/log/squid/squid.log Line no. 2522 aclour_networksscr192.168.1.0192.168.2.0/24 (herechangewithyournetworkrange) Line no. 2523 hdp_accessallowour_networks Line no. 2778 [email protected](changewithyouremailaddressorname) bydoingthesecongurabonyourinternet Now forA cce ssl ist Line no. 2409 (thereyouwillndtypedaclC ONN ECT met hod C ONNEC T,typeunderthatline) acl<anyname>url_regex<Websitesyouwanttoblockorinibals,downloadings> (aclxyzurl_regexorkutmp3downloadingwww.gmail.com) hdp_accessdeny<abovename>(xyz) aclxyzurl_regexwww.google.com hdp_accessallowxyz hdp_accessdenyall (savethele) (Onlythiswebsiteyouwantyourclienttoaccess) or
29
30
3. Editthisle #v i /et c/ dhc pd. c onf Subnet192.168.1.0 Opbondomainname example.com 192.168.1.1; netmask255.255.255.0
Opbondomainnameservers rangedynamicbootp
192.168.1.10192.168.1.20;
In this le we have to give our network range, domain name & its IP (opbonal), range of IP providedbyDHCPandifwewanttoxanyaddressforspecicuserwecanreserveIPforthat withthehelpofMACaddress. 4. # se rvic e dhc pd re st art 5. Now on client set the TCP/IP setng on obtain an IP address automabcally & obtain DNS serveraddressautomabcally.
31
DNS
ProvidesresolubonofnamestoIPaddressandresolubonofIPaddresstonames,denesa hierarchicalnamespacewhereeachlevelofanamespaceisseparatedbya.. ZoneZoneisastoragedatabasewhichcontainsallzonesrecords. Forward l ook upz one:UsedtoresolvehostnametoIPaddress.ItmaintainshosttoIP mappinginformabon. Ty pe s of R ec ords: SOARecord: NSRecord: Arecord: CNAMERecord: PTRRecord: MXRecord: Therstrecordinanyzonele. IdenbestheDNSServerforeachzone. ResolvesahostnametoIPaddress. Resolvesanaliasnametoahostname. ResolvesIPaddressforhostname. Usedbymailserver.
Re qui re d Pac k ag e s: bindchroot9.2.42.i386.rpm binddevel9.2.42.i386.rpm bindlibs9.2.42.i386.rpm bind* bindubls9.2.42.i386.rpm bind9.2.42.i386.rpm cachingnameserver7.33.noarch.rpm systemcongbind P ort num be r:53DNS Se rv ic e/ Dae m on:named
32
1. Installbind #y umi nst al l bi nd* # rpm iv h bind* #y umi nst al lc ac hing * # rpm iv h cachi ng * # yum i nst all sy st emc on g bi nd* # rpm iv h syste mc on g bi nd* 2. Copythele
#c p / usr/share / doc / bi nd9.3. 3/ sam pl e/ v ar/ nam e d/ nam e d. root /v ar/ nam e d/ chroot /v ar/name d 3. Nowongraphicalterminal (checkthatinnetworktabtheremustbeyoursIPaddressinDNStab) # sy st emc on gbi nd Nowawindowcomesthererig ht clic k on DN S se rve r addz onei nte rne t ok forw ardl ook upz one ok rahul. c om (g iv et he dom ai n nam e )(ok ) Nowrig ht cl ick on dom ai n nam e (ra hul.c om) addIP v4 addre ss (A ) ww w. rahul.c om (full dom ai n nam e) t he n IP v 4addre ss (192.168 .1 .. ) 4. # se rvic e nam e d re st art 5. Forreverselookupzone255 R. CI nt e rnet R ev e rse IP v4z one R .C. add NS (N am e Serv er) Se rv e r Dom ai n N am e: ww w. rahul. c om (sav e) 6. # se rvic e nam e d re st art 7. TocheckwhetheryourDNSserverisworking #hostwww.rahul.com #host192.168.1.1 (forwardlookupzone) (Reverselookupzone)
#digwww.rahul.com/192.168.1.1 #nslookupwww.rahul.com/192.168.1.1 8. On client PC add your IP in DNS tab in TCP/IP setngs and ping the domain name, if it completes successfully, means your forward lookup zone is working and ping a <ip address>,ifitgivesdomainnameitmeansreverselookupzoneisworking.(onwindows)
33
NFS SE RVE R
Sharingofles&foldersbetweenLinux. Pac k ag e s: portmap4.063.i386.rpm nfsubls1.0.64.6.i386.rpm Port N um be r: 2049nfsd 111portmap Con g urab on Fil e: /etc/exports Servic e: portmap nfs Dae m ons: nfsd 1. Createafolderandmakelesorpastelesyouwanttosharefrominnetwork.(ex./var/dump) 2. Editleforsharing #vi/etc/exports /var/dump *(rw) /var/rahul 192.168.1.15(ro) (savethele) (inrstline,wehaveshare/var/dumpforallusersinanetworkwithread&writepermission&in second line, wehaveshared /var/rahulonlyforthe PChavingIPaddress192.168.1.15withread onlypermission) 3. #servicenfsrestart 4. #serviceportmaprestart 5. #showmounte (TocheckNFSServeranditsshareddirectoryfromServeritself)
34
8. ForinstallabonfromNFS,copywholeDVD/CDinafolderandshareit. 9. Boot from CD on another client computer, write linux askmethod, here it will ask to select the installabonmedia,selectNFS,nowitwillaskto giveIPforyourclientcomputer,giveIP,Nowit will ask for Name of NFS Server: <Give IP of NFS Server>, and directory : <Give the path>. Now yoursystemwillinstallveryquicklywiththehelpofNFSserver.
(atlastofle,pressingGcopythefollowinglineandpastethelinesandthenremove;infontof theline.) [MyShare] comment= path= validusers= public=no writable=no printable=no savethele. 3. #servicesmbrestart 4. TocreateSambausers #useradd<username> #smbpasswda<username> 5. Tochecksambaisconguredofnot (Sharename) (anycomment) (heregivethepathwhichyouwanttoshare) (Heregivesambausers) (Heregivethepermissionyouwanttogive)
35
NIS SE RVE R
NISserverisjustlikeAcbveDirectoryServicesinWindows.NISserverneedNFSserver,soitisnecessary toinstallNFSserverbeforeNIS. 1. Setthehostname #hostnamerahul.com 2. Setthedomainname #domainnamerahul.com 3. Installthepackage #yuminstallypserv* #rpmivhypserv* 4. Nowcreateasmanyasuseryouwanttocreate.Share/homeinNFSserver. #vi/etc/exports /home *(rw,sync) (savethele)
5. #servicenfsrestart #serviceportmaprestart #serviceypservrestart 6. #cd/usr/lib/yp 7. #./ypinitm 8. On Cli e nt: #setup(hereawindowwillbeopen,heremark*inNISopbon,itwillaskfordomain&IPOK) 9. #vi/etc/auto.master /home /etc/auto.misc (savethele) (inthisleitwillaskforhostname,addhostname,thenctrl+D)
11.#serviceautofsrestart
36
(Nowyouclientisready,loginwiththeuserthatyouhavecreatedonServerandmakeleyou willndthatleonServer.)
(savethele)
5. NowwhenyouentertheDomainname(www.rahul.com)itwillopenyourwebpage) 6. AUTHE NTI CATI ON: openthesameleandattheendofle,typethefollowing <Directory AuthUserle AuthName AuthType Require </Directory> 7. Adduserforhdp #useraddrahul #htpasswdc/etc/hdpd/conf/htpasswdrahul /var/www/html> /etc/hdpd/conf/htpasswd WebAuthenbcabon Basic ValidUser
(savethele)
37
(itcreatesanewlehtpasswdandadduserrahulinit) Foraddingmoreuser #htpasswd/etc/hdpd/conf/htpasswd<username> 8. Vi rt ual H osb ng Firstcopytheabovefourlines <Virtualhost*:80> Documentroot/var/www Servernamewww.yahoo.com </Virtualhost> (change*withIPaddressatbothplace) (againstartservice)
SENDMA IL
Pac k ag e s: send* 1. # rpm iv h ai d se nd* #y umi nst al l se nd* 2. # vi / etc/ se ndm ai l.m c Lineno.116 deamon_opbons(Port=smtp,addr=127.0.0.0,name=mta)dnl(adddnl#atthebeginning) savethele. 3. #m4/etc/mail/sendmail.mc>/etc/mail/sendmail.cf 4. #servicesendmailrestart 5. MA IL: #[email protected] Con g urab on Fil e: /etc/sendmail.mc
38
39
FTP
Re qui re d Pac k ag e Vsftpd* 1. # rpm iv h v s] pd* #y umi nst al lv s] pd* 2. #v i/ etc /v s] pd/v s] pd.c onf Wehavetoremove#infrontofthefollowinglines. Line no. 12: anonymous=defaultuser
(FTPusestwousersanonymous&FTPanonymoushasnopassword) Line no. 15: local_enable=yes (LocalusercanloginthroughFTP) Line no. 18: write_enable=yes (writepermissionisenabledtoFTP) Line no. 27: anon_upload_enable=yes (anonymoususercanuploadles) Line no. 31: anon_mkdir_write_enable=yes (anonymoususercancreatedirectory) Line no. 35: dirmessageenable=yes Line no. 85: Ftpd_banner=welcometoFTP 3. # se rvic ev s] pd restart 4. Cli ente nd: ]p<ServerIP> >cdpub >get<lename> >put<lename> (download) (upload)
40
>bye (exit)
41