Next Previous Contents

3. Sthnontas enan NFS server

3.1 Proapaitoumena

Prin synexisete thn anagnwsh aytou edw toy HOWTO, 8a xreiastei na gnwrizete pws na kanete telnet metaju server kai client, kai pros tis duo katey8unseis. An to telnet den doyleuei, janakoitajte to Networking/NET-3 HOWTO, kai sthste th diktuwsh swsta.

3.2 Prwto bhma

Prin mporesoyme na kanoyme o,tidhpote, xreiazomaste ena sthsimo gia ton NFS server. An eisaste melos enos etairikou h panepisthmiakou diktuoy, pi8anotata 8a breite kamposoys NFS servers hdh sthmenoys. An oi SysAdmins sas afhsoyn na exete prosbash s' aytous toys H/Y, h an diabazete ayto to HOWTO gia n' apokthsete prosbash s' enan tetoio H/Y, profanws den xreiazetai na diabasete ayto to kommati, kai mporeite apla na pate pio katw, sto Ry8mizontas ton NFS client .

An 8elete na sthsete enan H/Y poy den basizetai sto Linux san server, prepei na diabasete ta egxeiridia toy, gia n' anakalucete pws energopoieitai to NFS serving kai to export twn filesystems mesw toy NFS. Yparxei mia xwristh enothta s' ayto edw to HowTo, gia to pws ginetai ayth h doyleia se diaforetika LS. Afou, loipon, exete jeka8arisei ola ta parapanw, mporeite na synexisete me thn anagnwsh ths epomenhs enothtas toy parontos HowTo. 'H na diabasete perissotera s' ayto to kommati, afou kapoia apo ta pragmata poy 8a pw einai sxetika me to 8ema, adiaforo ti H/Y xrhsimopoieite gia server.

An biazeste, parakalw diabaste to To NFS sto Linux 2.2 , prin synexisete na diabazete edw.

Osoi synexizete to diabasma, 8a xreiastei na ry8misete merika programmata.

3.3 O portmapper

O portmapper sto Linux onomazetai eite portmap , h rpc.portmap. H sxetikh selida ths entolhs man ston H/Y moy leei oti prokeitai gia enan "xarth 8yrwn DARPA pros ari8mous programmatwn RPC". Einai h prwth trupa asfaleias poy 8' anoijete m' ayto edw to HowTo. H perigrafh gia to pws 8a thn kleisete, brisketai sto Asfaleia kai NFS. To opoio kai sas parotrunw jana na diabasete.

3ekinhste ton portmapper. Onomazetai eite portmap , h rpc.portmap , kai prepei na brisketai mesa sto directory /usr/sbin (poy se merikous H/Y legetai rpcbind). Mporeite na ton jekinhsete me to xeri twra, alla prepei na ton jekinate kai ka8e fora poy bootarete ton H/Y sas, ara prepei na ftiajete h na dior8wsete ta rc scripts. Ayta ta scripts ejhgountai leptomerestera sth selida man gia thn entolh init, kai synh8ws briskontai sta dirs /etc/rc.d, /etc/init.d , h /etc/rc.d/init.d. Ean yparxei ena script me onoma kati san inet , einai pi8anotata to script poy zhtate gia dior8wsh. Alla, osa 8a gracete h 8a kanete, briskontai ejw apo ta oria toy parontos HowTo. 3ekinhste ton portmap, kai elegjte oti doyleuei, trexontas : ps aux kai meta rpcinfo -p. Doyleuei; Kalws.

A, kati akomh : H apo makria prosbash ston portmapper sas ry8mizetai apo ta periexomena twn arxeiwn /etc/hosts.allow kai /etc/hosts.deny . An apotuxei to rpcinfo -p , alla o portmapper sas trexei, parakalw ejetaste ta sygkekrimena arxeia. Des to Asfaleia kai NFS , gia leptomereies epanw s' ayta ta arxeia.

3.4 Oi mountd kai nfsd

Ta epomena programmata poy prepei na baloyme na trexoyn einai oi mountd kai nfsd. Alla prwta, 8a dior8wsoyme ena allo arxeio, ayth h fora to /etc/exports . As poume oti 8elw to filesystem /mn/eris/local , to opoio yparxei epanw ston H/Y eris , na einai dia8esimo ston H/Y apollon. Tote, 8a ebaza thn ejhs grammh sto arxeio /etc/exports ths eris :


/mn/eris/local  apollon(rw)

H parapanw grammh dinei ston apollon prosbash read/write sto /mn/eris/local. Anti gia rw , 8a mporouse kai na leei ro, poy shmainei "mono gia diabasma" (read only - an den gracete tipote, to default einai read only). Yparxoyn ki alles epiloges poy mporeite na dwsete, kai parakatw 8a syzhthsw merikes sxetizomenes me thn asfaleia. Pantws, oles apari8mountai sth selida man gia to exports , thn opoia prepei na diabasete toylaxiston mia fora sth zwh sas. Epishs, yparxoyn kaluteroi tropoi, apo to na gracete sto arxeio exports oloklhrh th lista twn hosts. Px mporeite na xrhsimopoihsete omades (groups) sto diktyo, an trexete to NIS (h NYS - to NIS htane gnwsto ws "Kitrines Selides", Yellow Pages, YP), kai panta na balete wildcards gia ta domains kai ta ypodiktya (subnets) twn IP's, perigrafontas toys hosts poy epitrepetai na fortwsoyn kati. Alla prepei kai na skef8eite poios einai pi8ano na apokthsei mh ejoysiodothmenh prosbash ston server, se periptwsh poy xrhsimopoieite omadikes ejoysiodothseis.

Shmeiwsh : To arxeio exports den syntassetai me ton idio tropo, opws se alla *nix's. Yparxei jexwristh enothta sto paron HOWTO sxetika me ta arxeia exports twn allwn *nix's.

Twra, prepei na jekinhsoyme ton mountd (poy isws legetai kai rpc.mountd), kai meta ton nfsd (isws legetai kai rpc.nfsd). Kai oi duo 8a diabasoyn to arxeio exports.

An dior8wsete to /etc/exports , 8a prepei na bebaiw8eite oti oi nfsd kai mountd gnwrizoyn oti to arxeio allaje. O paradosiakos tropos einai na trejete to exportfs, omws polles dianomes toy Linux den dia8etoyn programma exportfs. An oute h dikh sas dianomh dia8etei, mporeite na egkatasthsete to ejhs script ston H/Y sas :


#!/bin/sh
killall -HUP /usr/sbin/rpc.mountd
killall -HUP /usr/sbin/rpc.nfsd
echo re-exported file systems

Swste to px sto /usr/sbin/exportfs, kai mhn jexasete na dwsete chmod a+rx . Twra, ka8e fora poy allazete to exports arxeio sas, meta trejte to exportfs ws root.

Twra, elegjte oti oi mountd kai nfsd trexoyn swsta. Prwta me to rpcinfo -p. Ayto prepei na deijei kati, opws to parakatw :


   program vers proto   port
    100000    2   tcp    111  portmapper
    100000    2   udp    111  portmapper
    100005    1   udp    745  mountd
    100005    1   tcp    747  mountd
    100003    2   udp   2049  nfs
    100003    2   tcp   2049  nfs

Opws blepete, o portmapper exei anaggeilei tis yphresies (services) toy, opws kai oi mountd kai nfsd.

An labete mhnyma rpcinfo: can't contact portmapper: RPC: Remote system error - Connection refused, RPC_PROG_NOT_REGISTERED, h kati paromoio, tote o portmapper den trexei. 'H, exete kapoies grammes sta arxeia /etc/hosts.{allow,deny} , poy apagoreuoyn ston portmapper n' apanthsei. Parakalw diabaste to Asfaleia kai NFS gia leptomereies epanw s' ayta ta arxeia. An labete to mhnyma No remote programs registered. , tote eite o portmapper den 8elei koybenta me sas, h kapoia sundesh espase. Kante kill stoys nfsd kai mountd, ka8ws kai ston portmapper, kai janaprospa8hste ap' thn arxh.

Afou elegjete to oti o portmapper anaferei tis yphresies (services) toy, mporeite na dokimasete kai me to ps. O portmapper 8a synexisei n' anaferei yphresies, akomh kai afou exoyn krasarei ta programmata poy tis epekteinoyn. Ara, enas elegxos sto ps einai kati aparaithto, an fanei oti kapoia sundesh den doyleuei.

Fysika, prepei na tropopoihsete ta arxeia rc toy H/Y sas, gia na jekinhsoyn me to bootarisma oi mountd kai nfsd, ka8ws kai o portmapper. Einai polu pi8ano oti ta sxetika scripts hdh yparxoyn ston H/Y sas, apla prepei na bgalete ta sxolia apo tis shmantikes grammes, h na energopoihsete ton H/Y sta swsta epipeda init run.

Oi selides man, me tis opoies prepei na eisaste ejoikeiwmenoi s' ayto to shmeio : portmap, mountd, nfsd, kai exports.

Loipon, an ta kanate ola akribws opws sas ta eipa, eisaste etoimoi na jekinhsete ton NFS client.


Next Previous Contents