11 11 TEX L^{A}TEX

Root over nfs clients & server Howto.

Hans de Goede hans@highrise.nl v1.0 30 Martioy 1999

Pws na sthsoyme enan server kai na ry8misoyme toys clients gia na doyleuoyn xwris disko/oys mesa s’ ena diktyo.

Contents

1 Eisagwgh 2 1.1 Pneymatika Dikaiwmata . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2 1.2 Katalogos allagwn . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3

2 Basikes arxes 3

2.1 Ta pragmata den einai toso apla . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3

2.1.1 Ka8e ws xreiazetai to (me dynatothta eggrafhs) diko toy antigrafo enos ari8mou apo

katalogoys. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3 2.1.2 Mporei n’ anagkastoume na dwsoyme dikaiwma eggrafhs sto /home . . . . . . . . . . 4 2.1.3 Pws briskei enas ws to ip toy, wste na epikoinwnhsei me ton server; . . . . . . . . . . 4 2.1.4 Ti ginetai me tis ry8miseis gia ka8e ws . . . . . . . . . . . . . . . . . . . . . . . . . . 5 2.1.5 Diafora problhmata . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5

3 Proetoimazontas ton server 5 3.1 Xtizontas enan pyrhna. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5 3.2 Ftiaxnontas kai gemizontas to /tftpboot, dhmioyrgwntas symlinks gia to /tmp, klp. . . . . . 7

3.2.1 To aytomato meros . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7 3.2.2 Ry8miseis me to xeri gia merika arxeia . . . . . . . . . . . . . . . . . . . . . . . . . . 10

3.3 Kanoyme export ta katallhla file systems kai ry8mizoyme to bootp . . . . . . . . . . . . . . . 10 3.3.1 Kanoyme export ta katallhla file systems . . . . . . . . . . . . . . . . . . . . . . . . . 11 3.3.2 Ry8mizontas to bootp . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11

4 Pros8etontas workstations 11

4.1 Ftiaxnontas disketa h EPROM ekkinhshs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11 4.1.1 Ftiaxnontas disketa ekkinhshs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11 4.1.2 Ftiaxnontas EPROM ekkinhshs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12

4.2 Ftiaxnontas ena ws dir . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12 4.3 Pros8etontas grammes sta /etc/bootptab kai /etc/hosts . . . . . . . . . . . . . . . . . . . . . 12 4.4 Ekkinwntas ton ws gia prwth fora . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13 4.5 Kanontas tis eidikes gia ton ws ry8miseis. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13

5 Pros8eto dwraki : Ekkinwntas apo cd-rom 13

5.1 Basikh arxh . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14

5.1.1 Ta pragmata den mporei na einai toso apla . . . . . . . . . . . . . . . . . . . . . . . . 14 5.2 Ftiaxnontas ena dokimastiko sthsimo. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14 5.3 Ftiaxnontas to cd . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16

5.3.1 Ftiaxnontas ena boot image . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16 5.3.2 Dhmioyrgwntas to iso image . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17 5.3.3 Epalh8euontas to iso image . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18 5.3.4 Grafontas to CD . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18

5.4 Bootarete to CD kai dokimaste to . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18

6 Eyxaristw 18

7 Sxolia 18

1 Eisagwgh

Ayto to howto einai epishs dia8esimo sto - <http://xmame.retrogames.com/hans>. Ayto to keimeno perigrafei to sthsimo toy "nfs over root". Diaferei apo ta alla paromoia howto’s toy tupoy "root over nfs" se duo shmeia :

1. Perigrafei kai thn pleyra toy server kai thn pleyra toy client, prosferontas mia plhrh lush. Den perigrafei tis genikes arxes toy "root over nfs" sxhmatos, an kai aytes 8a fanoun ka8ara. Anti8eta, prosferei ena sthsimo (poy doyleuei sthn prajh) gia to "root over nfs". Ena apo ta polla pi8ana sthsimata, 8a mporousa na pw.

2. Ayth h lush einai monadikh, ypo thn ennoia oti moirazetai to root toy server mazi me toys termatikous ypologistes (workstations - ws), anti na exei ena mini-root ana ws. Etsi exoyme kamposa pleonekthmata :

• Xrhsh mikrou posostou ths xwrhtikothtas toy diskoy.

• Ka8e allagh sthn pleyra toy server aytomata ginetai kai sthn pleyra toy client, dhl. oles oi ry8miseis ginontai mono mia fora!

• Pros8etoyme polu eukola neoys clients.

• Exoyme monon enan H/Y na synthrhsoyme.

Ayto to keimeno basizetai kyriws sto ti ginetai s’ enan H/Y me RedHat 5.2 . Gia na to diabasete, apaiteitai kamposh empeiria ws SysAdmin se Linux. Ean thn exete, den 8a einai problhma na prosarmosete th lush aythn edw kai se alles dianomes.

1.1 Pneymatika Dikaiwmata

Oriste kai h stantar nomikh pleyra twn howto’s :

Ayto to keimeno mporei n’ anaparax8ei kai na dianemh8ei oloklhro h kata merh, xwris xrewsh, ypo toys akoloy8oys oroys :

• H pio panw anafora sto copyright, ka8ws kai ayth edw h anafora stoys oroys ths adeias xrhshs prepei na thrh8oun akeraies se opoiasdhpote morfhs antigrafo, plhres h tmhmatiko.

• Ka8e metafrash h paragwgh ergasia, prepei na egkri8oun graptws apo ton syggrafea prin th dianomh toys.

• Ean dianeimete ayto to keimeno se tmhmata, prepei na symperilabete odhgies gia to pws 8a brei kapoios to plhres keimeno, ka8ws kai ena meso gia na brei to plhres keimeno.

• Mikra tmhmata mporoun na anaparax8oun ws paradeigmata se entypa, h ws anafores se alles ergasies, xwris na periexoyn aythn edw thn adeia, ean yparxei h anafora toy arxikou keimenoy.

Gia akadhmaikous skopous, mporoun na ginoyn ejaireseis sta parapanw : Gracte ston syggrafea kai zhthste to. Aytoi oi periorismoi yparxoyn edw, gia na prostateuoyn emas, ws syggrafeis, oxi gia na periorizoyn esas, ws ekpaideytes h ma8htes.

1.2 Katalogos allagwn

• v0.1, 20 Ianoyarioy 1999 : To prwto proxeiro keimeno grafthke sto HHS, opoy kai sth8hkan oi ry8miseis poy perigrafontai.

• v1.0, 30 Martioy 1999 : Grafthke ena meros ths prwths morfhs pros dianomh, kata ton xrono poy hmoyna sthn ISM.

2 Basikes arxes

Ka8ws hdh eipame, oi clients moirazontai oloklhro to root-fs me ton server. Alla, fysika, oi clients mporoun mono na to diabasoyn : Aytos einai o tropos leitoyrgias toy sygkekrimenoy systhmatos.

2.1 Ta pragmata den einai toso apla

Dystyxws, ta pragmata den einai toso apla. Yparxoyn kanadyo problhmata, poy prepei na jeperasoyme s’ ayto to aplo sxhma.

2.1.1 Ka8e ws xreiazetai to (me dynatothta eggrafhs) diko toy antigrafo enos ari8mou apo katalogoys.

Sto synh8ismeno sthsimo, to Linux prepei na mporei na gracei stoys ejhs katalogoys :

1. /dev

2. /var

3. /tmp

Yparxoyn 3 luseis gi’ ayto, apo tis opoies h mia 8a doylecei mono sto /dev :

1. fortwnoyme ena ramdisk kai to gemizoyme me untarring enos tarball, h antigrafontas ena protypo (template) katalogo.

• Pleonekthmata :

(a) Ka8arizei me ka8e epanekkinhsh, h opoia sbhnei arxeia .tmp kai arxeia logs. Den xreiazetai synthrhsh, anti8eta ap’ o,ti oi katalogoi sthn pleyra toy server.

(b) Den katalambanei xwro ston server, kai de dhmioyrgei kykloforia sto diktyo. Ena ramdisk

xrhsimopoiei ligoteroys poroys toy server kai toy diktuoy, kai einai taxutero.

• Meionekthmata :

(a) Katalambanei mnhmh.

(b) Ta logs den diathrountai meta apo epanekkinhsh. Ean pragmatika xreiazeste logging gia ola ta clients, peite sto syslog na epanakatey8unei to logging pros ton server.

2. dhmioyrgoume ena dir gia ka8e ws epanw ston server, kai to fortwnoyme rw epanw sto nfs.

• Pleonekthmata & meionekthmata :

(a) Gia ta dirs toy server, ta parapanw pleonekthmata-meionekthmata antistrefontai.

3. Ston kernel 2.2, to devfs mporei na xrhsimopoih8ei anti toy /dev . Ayto einai ena virtual filesystem, san to /proc toy /dev.

• (a) Pleonekthmata :

(b) To devfs xreiazetai elaxisth mnhmh, moiazei me ramdisk / ka8oloy xwro sklhrou diskoy epanw ston server, kai einai taxutato. Ena synh8ismeno /dev xreiazetai toylaxiston 1.5 MB, afou to elaxisto mege8os arxeioy (kai ara enos device) einai 1k, kai yparxoyn peripoy 1200 devices. Fysika, mporeite na xrhsimopoihsete ena protypo "apogymnwmenoy" /dev, me mono ta periexomena poy 8elete, gia na ejoikonomhsete kamposo xwro. To 1.5 MB einai polu gia ramdisk, kai epishs den einai wraio epanw ston server.

(c) To devfs aytomata dhmioyrgei kataxwrhseis gia tis nees kai tis anixneymenes syskeyes, synep-

ws den xreiazetai synthrhsh.

• Meionekthmata :

(a) Xanetai ka8e allagh sto /dev , opws h dhmioyrgia symlinks gia to pontiki kai to cd-rom. To devfs exei ena script, to rc.devfs, poy swzei aytes tis allages. Ta scripts, poy sas dinw s’ ayto edw to howto, apoka8istoun aytomata tis ry8miseis twn symlinks, kalwntas to rc.devfs . An kanete opoiesdhpote allages sto /dev , xreiazetai na kalesete eseis to rc.devfs, gia na tis swsete, dinontas :

/etc/rc.d/rc.devfs save /etc/sysconfig

Opws blepete, yparxoyn kamposoi tropoi gia na ly8ei ayto to problhma. Gia to ypoloipo meros aytou toy howto, kratame tis akoloy8es epiloges :

• Anti gia to /dev , 8a xrhsimopoioume to devfs.

• Anti gia ta /var kai /tmp , 8a xrhsimopoioume ena diamoirazomeno (shared) ramdisk toy enos MB. (To kanoyme shared, gia na xrhsimopoihsoyme ton xwro toy oso to dynaton apotelesmatikotera.) To /tmp antika8istatai m’ ena symlink pros to /var/tmp , gia na kanoyme efikto ton diamoirasmo.

• Doyleuei ej isoy kala to na gemisoyme to ramdisk me tarballs, h protypa (template) dirs. Alla me ta protypa directories einai polu eykolotero na kanoyme allages, ara 8a xrhsimopoihsoyme ayta.

2.1.2 Mporei n’ anagkastoume na dwsoyme dikaiwma eggrafhs sto /home

Den einai pragmatiko problhma, afou se ka8e sthsimo client/server se *nix systhmata to /home fortwnetai rw apo ton server. ’Ara, 8a kanoyme akribws ayto! ;)

2.1.3 Pws briskei enas ws to ip toy, wste na epikoinwnhsei me ton server;

Eytyxws gia mas, ayto to problhma exei hdh ly8ei, kai o pyrhnas toy Linux yposthrizei duo tropoys aytomatoy ka8orismou ths dieu8ynshs ip :

1. RARP

2. Bootp

To rarp einai eykolotero sth ru8mish, to bootp einai to pio eyelikto. Mia poy oi perissoteres bootroms (ROMs ekkinhshs apo karta diktuoy) yposthrizoyn mono to bootp, ayto kai 8a xrhsimopoihsoyme.

2.1.4 Ti ginetai me tis ry8miseis gia ka8e ws

Sto RedHat, ta perissotera arxeia ry8misewn poy ejartwntai apo ton sygkekrimeno H/Y, briskontai hdh sto /etc/sysconfig . Emeis 8a metakinhsoyme monaxa osa den briskontai ekei, kai 8a baloyme symlinks. Meta, 8a fortwsoyme ena jexwristo /etc/sysconfig gia ka8e ws. Ki ayto einai to mono meros twn ry8misewn, poy ejartatai apo th distribution : Se alles distributions, mporeite apla na ftiajete ena directory ry8misewn, na metakinhsete ola ta mh diamoirazomena arxeia ry8misewn ekei, kai na dhmioyrghsete symlinks. Epishs, to /etc/rc.d/rc3.d (h ta paromoia twn ypoloipwn distributions) mporei na xreiastei na diaforopoih8oun ston server, ap’ o,ti einai stoys workstations. Ypo8etontas oti oloi oi ws trexoyne tis idies services sto runlevel 3, 8a ftiajoyme jexwrista runlevels 3 gia toys workstations kai ton server :

1. kataskeyh toy /etc/rc.d/rc3.ws kai toy /etc/rc.d/rc3.server

2. kanoyme to /etc/rc.d/rc3.d symlink pros to /etc/sysconfig/rc3.d

3. kanoyme to /etc/sysconfig/rc3.d symlink pros to katallhlo /etc/rc.d/rc3.xxx

4. antika8istoume to S99local sto rc3.ws m’ ena link pros to /etc/sysconfig/rc.local , wste ka8e ws na exei to diko toy rc.local

2.1.5 Diafora problhmata

Yparxoyn akomh kapoia problhmata :

1. To /etc/rc.d/rc.sysinit xreiazetai to /var, ara to /var prepei na fortw8ei h na dhmioyrgh8ei prin trejei to /etc/rc.d/rc.sysinit . Epishs, kalo 8a htan to gia ka8e ws /etc/sysconfig na fortw8ei prin trejoyn opoiadhpote initscripts.

• 8a dwsoyme ton kwdika gia ena script ekkinhshs gia ws, epanw-epanw sto /etc/rc.d/rc.sysinit . Shmeiwste oti ayto to script 8a to trejei (fysika) kai o server kata thn ekkinhsh, ara to script prepei na problecei ayto to endexomeno, kai na mhn kanei tipote epanw ston server.

2. Prepei na mporoume na gracoyme sto /etc/mtab :

• Ayto edw mporei na mas kanei kolpa! Apla ftiajte ena link pros to /proc/mounts , kai epishs ftiajte ena adeio arxeio mounts sto /proc , wste ta fsck kai mount na mhn parapone8oun oso trexoyn ta initscripts, otan to /proc den exei fortw8ei akomh. Shmeiwsh : To smb(u)mount den sebetai to na einai link to mtab, kai grafetai panw toy. Ara, an 8elete na xrhsimopoihsete to smb(u)mount, ftiajte wrapper scripts, poy apoka8istoun to symlink.

3 Proetoimazontas ton server

Twra eftase h stigmh na etoimasoyme ton server na ejyphrethsei diskless clients.

3.1 Xtizontas enan pyrhna.

To prwto pragma poy prepei na kanoyme, einai na xtisoyme enan pyrhna me ta anagkaia pragmata gia yposthrijh "root over nfs". Kante ta akoloy8a bhmata :

1. Afou 8a xrhsimopoihsoyme to RedHat 5.2 me pyrhna 2.2, prepei na bebaiw8oume oti to RedHat 5.2 mas einai etoimo gia ton pyrhna 2.2 . H RedHat dia8etei ena ejairetiko HowTo epanw s’ ayto to 8ema.

2. Proswpika, xrhsimopoihsa ton idio pyrhna kai gia ton server kai gia toys ws’s, gia n’ apofugw asymfwnies twn modules (module conflicts), afou server kai ws’s moirazontai ta idia /lib/modules . Ean ayto den einai dynaton sto diko sas diktyo, apomimh8eite diaforetikes ekdoseis toy pyrhna, allazontas ton ari8mo ekdoshs sto epanw-epanw makefile toy pyrhna sas. Oi diaforetikoi ari8moi ekdosewn 8a mhdenisoyn to endexomeno uparjhs conflicts.

3. Ektos apo ta synh8ismena, o pyrhnas prepei na exei ta ejhs :

• To ext2 compiled mesa toy (ean xrhsimopoih8ei ston server, h kai se client).

• Ta nfs kai root-over-nfs compiled mesa toy (ean xrhsimopoih8oun se client, h kai ston server), wste to nfs over root ston pyrhna 2.2 na energopoihsei to ip-autoconfig sto diktyo. Gia tis ry8miseis, 8a xrhsimopoihsoyme to bootp.

• Yposthrijh gia karta diktuoy stoys ws’s compiled mesa toy (an xrhsimopoih8ei se client, h kai ston server).

• To devfs compiled mesa toy (apaiteitai gia client, kalo omws na yparxei kai ston server).

• O,tidhpote allo xrhsimopoieite synh8ws, dhl. modules gia opoiodhpote allo device yparxei epanw ston server, h oloys / merikous ws’s, klp klp.

4. To source programma toy pyrhna xreiazetai dior8wsh, gia n’ allajoyme to ej orismou "root-over-nfs" mount se /tftpboot/<ip>/root , anti toy /tftpboot/<ip>. Ayto ginetai gia na paroyme ena "ka8aro" dentro apo directories sto /tftpboot , me ena ana dir ana ws, poy 8a periexei toso to root gia ton ws (ena link pros to pragmatiko root toy server), oso kai ka8e directory, poy xreiazetai eidika gia ton ws..

• Gia pyrhna 2.0 : Yaxnoyme ena "define" sto : "include/linux/nfs_fs.h" , me to onoma "NF-S_ROOT" .

• Gia pyrhna 2.2, to antistoixo "define" brisketai sto : "fs/nfs/nfsroot.c" .

5. Twra kanoyme ena synh8ismeno compile ston pyrhna (blepe to "Kernel HowTo").

6. Ean akomh den exete ena /dev/nfsroot , ftiajte to dinontas :

mknod /dev/nfsroot b 0 255.

7. Afou kanete compile ston pyrhna, balte to root sto nfsroot, dinontas :

rdev <path-to-zImage>/zImage /dev/nfsroot

8. Prin bootarete me to devfs, prepei na kanete liges allages sto /etc/conf.modules : Balte ta periexomena toy conf.modules sto meros toy devfs poy anaferetai s’ ayto.

9. Afou aytos o neos pyrhnas einai ftiagmenos gia aytomath ru8mish twn ip’s, kata thn ekkinhsh 8a prospa8hsei na ry8misei kai to ip toy server. Pragma to opoio, fysika, 8a apotuxei, mia poy o server dinei ta ip’s. Gia n’ apofugete ta megala timeouts, pros8este : append="ip=off" sto meros toy /etc/lilo.conf gia to Linux.

10. Trejte to lilo kai jekinhste ton neo pyrhna.

11. Ej aitias toy devfs, 8a exete xasei ola ta symlinks epanw ston server. Me to RedHat, ayta einai synh8ws ta /dev/mouse kai /dev/cdrom. 3anaftiajte ayta ta duo. Epishs, an xrhsimopoieite eidikes ownerships, kante chown pros ta katallhla arxeia sto /dev. Twra, swste tis ry8miseis toy /dev (sto /etc/sysconfig, afou mporei na ejartwntai apo toys ws’s) :

• Antigracte to rc.devfs apo to meros toy devfs sto source toy pyrhna, sto /etc/rc.d/rc.devfs kai kante to ektelesimo.

• Swste tis ry8miseis, dinontas :

/etc/rc.d/rc.devfs save /etc/sysconfig

3.2 Ftiaxnontas kai gemizontas to /tftpboot, dhmioyrgwntas symlinks gia to /tmp, klp.

To epomeno bhma einai na ftiajoyme kai na gemisoyme to /tftpboot

3.2.1 To aytomato meros

Ayto to xeirizetai oloklhro ena megalo script, mia poy to na symperilabw mia megalh lista entolwn s’ ayto to howto moy fanhke entelws axrhsto. An 8elete na efarmosete ayto edw to egxeiridio, apla diabaste to script kai plhktrologhste o,ti blepete! ;)

Ayto to script ry8mizei "brwmika" kapoia pragmata, px nukarei to /tmp, kanei proswrino kill sto syslog, kanei umount sto /proc. Synepws, bebaiw8eite oti (a) kanenas allos den xrhsimopoiei ton H/Y kata th diarkeia ayths ths diadikasias, kai oti (b) den trexoyne ta X-Windows. Arkei to na bebaiw8eite oti eisaste to mono atomo poy ekane login se periballon konsolas, den xreiazetai n’ allajete ta runlevels.

APOKHRY3H : Ayto to script einai dokimasmeno, alla an wstoso kanei mpaxalo ton server sas, den 8a sas boh8hsw. Den mporw na parw opoiadhpote ey8unh. Prepei na epanalabw oti ayto to HowTo proorizetai mono gia empeiroys Linux SysAdmins. Epishs, ayto to script sxediasthke gia na xrhsimopoih8ei mono mia fora, kai ennow MIA fora. An to trejete duo fores, 8a nukarei ta : /etc/fstab, /etc/X11/XF86Config, /etc/X11/X kai /etc/conf.modules.

Twra, afou eipame ta parapanw, apla kante cut/paste to script, kante to ektelesimo, ekteleste to, kai proseyxh8eite ston Agio Pigkoyino na doylecei! ;)

#!/bin/sh
SERVER_NAME=`hostname -s`
###
echo ftiaxnoume to /etc/rc.d/rc.ws
#auto edw apla kanei echo s' olo to script ;)
echo "# gia to root on nfs
SERVER=$SERVER_NAME
#xreiazomaste to proc gia to mtab, route klp
mount -t proc /proc /proc

IP=\`ifconfig eth0|grep inet|cut --field 2 -d ':'|cut --field 1 -d ' '\`
#an apotuxei to prwto mount, pi8anotata o server, h toulaxiston kati allo
#den pane kala, ara kanoume monaxa ta upoloipa, an to prwto mount petuxei
mount \$SERVER:/tftpboot/\$IP/sysconfig /etc/sysconfig -o nolock &&
{
   #other mounts
   mount \$SERVER:/home /home -o nolock
   mount \$SERVER:/ /\$SERVER -o ro,nolock
   #/var
   echo Ftiaxnoume to /var ...
   mke2fs -q -i 1024 /dev/ram1 1024
   mount /dev/ram1 /var -o defaults,rw
   cp -a /tftpboot/var /
   #network stuff
   . /etc/sysconfig/network
   HOSTNAME=\`cat /etc/hosts|grep \$IP|cut --field 2\`
   route add default gw \$GATEWAY
   ifup lo
}
#restore devfs settings
/etc/rc.d/rc.devfs restore /etc/sysconfig
umount /proc" > /etc/rc.d/rc.ws
###
echo xwrizoume to runlevel 3 gia ton client kai gia ton server
mv /etc/rc.d/rc3.d /etc/rc.d/rc3.server
cp -a /etc/rc.d/rc3.server /etc/rc.d/rc3.ws
rm /etc/rc.d/rc3.ws/*network
rm /etc/rc.d/rc3.ws/*nfs
rm /etc/rc.d/rc3.ws/*nfsfs
rm /etc/rc.d/rc3.ws/S99local
ln -s /etc/sysconfig/rc.local /etc/rc.d/rc3.ws/S99local
ln -s /etc/rc.d/rc3.server /etc/sysconfig/rc3.d
ln -s /etc/sysconfig/rc3.d /etc/rc.d/rc3.d
###
echo kanoume to tmp link gia to /var/tmp
rm -fR /tmp
ln -s var/tmp /tmp
###

echo metakinoume diafora arxeia kai ftiaxnoume symlinks gi auta
echo mtab
/etc/rc.d/init.d/syslog stop
umount /proc
touch /proc/mounts
mount /proc
/etc/rc.d/init.d/syslog start
rm /etc/mtab
ln -s /proc/mounts /etc/mtab
echo fstab
mv /etc/fstab /etc/sysconfig
ln -s sysconfig/fstab /etc/fstab
echo arxeia ry8misewn twn X
mkdir /etc/sysconfig/X11
mv /etc/X11/X /etc/sysconfig/X11
ln -s ../sysconfig/X11/X /etc/X11/X
mv /etc/X11/XF86Config /etc/sysconfig/X11
ln -s ../sysconfig/X11/XF86Config /etc/X11/XF86Config
echo conf.modules
mv /etc/conf.modules /etc/sysconfig
ln -s sysconfig/conf.modules /etc/conf.modules
echo isapnp.conf
mv /etc/isapnp.conf /etc/sysconfig
ln -s sysconfig/isapnp.conf /etc/isapnp.conf
###
echo ftiaxnoume ena protupo dir gia ta directories twn wss
echo /tftpboot/template
mkdir /home/tftpboot
ln -s home/tftpboot /tftpboot
mkdir /tftpboot/template
mkdir /$SERVER_NAME
echo root
ln -s / /tftpboot/template/root
echo sysconfig
cp -a /etc/sysconfig /tftpboot/template/sysconfig
rm -fR /tftpboot/template/sysconfig/network-scripts
ln -s /$SERVER_NAME/etc/sysconfig/network-scripts \
 /tftpboot/template/sysconfig/network-scripts
echo NETWORKING=yes > /tftpboot/template/sysconfig/network
echo `grep "GATEWAY=" /etc/sysconfig/network` >> /tftpboot/template/sysconfig/network
echo "/dev/nfsroot / nfs defaults 1 1" > /tftpboot/template/sysconfig/fstab
echo "none /proc proc defaults 0 0" >> /tftpboot/template/sysconfig/fstab
echo "#!/bin/sh" > /tftpboot/template/sysconfig/rc.local
chmod 755 /tftpboot/template/sysconfig/rc.local
rm /tftpboot/template/sysconfig/rc3.d
ln -s /etc/rc.d/rc3.ws /tftpboot/template/sysconfig/rc3.d

rm /tftpboot/template/sysconfig/isapnp.conf
echo var
cp -a /var /tftpboot/var
rm -fR /tftpboot/var/lib
ln -s /$SERVER_NAME/var/lib /tftpboot/var/lib
rm -fR /tftpboot/var/catman
ln -s /$SERVER_NAME/var/catman /tftpboot/var/catman
rm -fR /tftpboot/var/log/httpd
rm -f /tftpboot/var/log/samba/*
for i in `find /tftpboot/var/log -type f`; do cat /dev/null > $i; done
rm `find /tftpboot/var/lock -type f`
rm `find /tftpboot/var/run -type f`
echo /sbin/fsck.nfs
echo "#!/bin/sh
exit 0" > /sbin/fsck.nfs
chmod 755 /sbin/fsck.nfs
echo ola teleiwmena

3.2.2 Ry8miseis me to xeri gia merika arxeia

Twra prepei na kanoyme merikes ry8miseis me to xeri ston server :

1. To source toy script ry8misewn twn ws’s prepei na to baloyme epanw-epanw sto rc.sysinit, synepws balte tis ejhs grammes amesws meta ton orismo toy PATH :

     #Gia root over nfs workstations.
     /etc/rc.d/rc.ws

2. Aplopoieiste to /etc/rc.d/rc3.ws sto elaxisto dynaton. Mporei na sas fanei xrhsimo na ftiajete kati san : rc.local.ws , alla ayto to afhnw se sas. To diktyo kai to nfs-fs einai hdh ry8mismena. To script exei hdh sbhsei h ananewsei ta parakatw :

• diktyo

• nfsfs

• nfs

• rc.local

3.3 Kanoyme export ta katallhla file systems kai ry8mizoyme to bootp

Fysika, o server prepei na kanei export sta katallhla filesystems, kai na dwsei tis diey8unseis ip stoys clients.

3.3.1 Kanoyme export ta katallhla file systems

Prepei na kanoyme export merika dir’s gia toys ws’s, epomenws gia to ergasthrio edw sto panepisthmio ekana tis akoloy8es pros8hkes sto /etc/exports :

/ *.st.hhs.nl(ro,no_root_squash)
/home *.st.hhs.nl(rw,no_root_squash)

Fysika, xrhsimopoieiste to katallhlo domain ;) kai epanekkinhste to nfs, dinontas :

/etc/rc.d/init.d/nfs restart

Shmeiwsh gia xrhstes knfsd : To knfsd den epitrepei na exoyme pollapla exports epanw se mia partition me diaforetikes adeies. Epishs, to knfsd den epitrepei ta clients na yperboun ta oria twn partitions. Px, an ena client kanei mount sto / , kai to /usr einai se diaforetikh partition, tote den 8a dei to /usr. Etsi, an xrhsimopoieite to knfsd, epanw se diaforetikh partition 8a eprepe na brisketai toylaxiston to /home . To script proetoimasias toy server hdh bazei to /tftpboot sto /home , ara ayto den xreiazetai na mpei se jexwristh partition. Ean yparxoyn ki alles partitions, stis opoies oi clients prepei na exoyn prosbash, kante jexwristo export gi’ aytes, kai pros8este entoles mount sto /etc/rc.d/rc.ws .

3.3.2 Ry8mizontas to bootp

1. An to bootp den einai hdh egkatesthmeno, egkatasthste to. Periexetai sto RedHat.

2. Dior8wste to /etc/inetd.conf kai bgalte to sxolio apo th grammh poy arxizei me to bootps. An 8elete na xrhsimopoihsete EPROM ekkinhshs, bgalte to sxolio mprosta apo apo th grammh poy milaei gia to tftp.

3. Epanekkinhste ton inetd, dinontas :

/etc/rc.d/init.d/inetd restart

4 Pros8etontas workstations

Twra, poy o server einai etoimos, mporoume n’ arxisoyme na pros8etoyme ws’s.

4.1 Ftiaxnontas disketa h EPROM ekkinhshs

Den xreiazetai na tis ftiajete kai tis duo mazi, gia na jekinhsei o ws.

4.1.1 Ftiaxnontas disketa ekkinhshs

Akomh ki an 8elete na xrhsimopoihsete EPROM ekkinhshs, einai xrhsimo na dokimasete prwta thn ekkinhsh me mia disketa. Gia na ftiajete th disketa, dwste :

dd if=/<path-to-zImage>/zImage of=/dev/fd0 4.1.2 Ftiaxnontas EPROM ekkinhshs

Yparxoyn kamposa free programmata gia kataskeyh EPROM ekkinhshs :

1. To netboot, poy kata thn tapeinh moy gnwmh einai to plhrestero free programma poy yparxei. Ayto xrhsimopoiei stantar drivers gia DOS, synepws yposthrizontai sxedon oles oi kartes. Mia polu xrhsimh ypodeijh poy phra apo thn mailing list toys, htan na spasw merikous drivers me to pklite, afou aytoi htane polu megaloi, wste na xwresoyn se mia EPROM ekkinhshs. H tekmhriwsh toy netboot einai arketa plhrhs, etsi den 8a xasw xrono na thn antigracw edw. Einai eparkhs gia na ftiajete mia EPROM ekkinhshs, kai na ekkinhsete enan ws m’ aythn. H selida toy netboot einai h : <http://www.han.de/

     gero/netboot/> .

2. To etherboot, ena allo free programma poy exei merika omorfa xarakthristika, opws h yposthrijh dhcp, alla exei periorismenh yposthrijh gia drivers, mia poy xrhsimopoiei to diko toy driver format. Ayto den to exw xrhsimopoihsei, ara den mporw na dwsw alles xrhsimes plhrofories. H selida toy Etherboot

     einai h : <http://www.slug.org.au/etherboot/> .

Sxetika me tis ides tis EPROMs : Oi perissoteres kartes diktuoy dexontai synh8ismenes EPROMs se bash 28 akidwn dip. Aytes oi EPROMs ftanoyn mexri ta 64kB. Gia tis perissoteres kartes 8a xreiasteite EPROMs twn 32kB me to netboot. Merikoi drivers xwrane se 16kB, alla h diafora timhs twn sxetikwn EPROMs einai elaxisth. Aytes oi EPROMs grafontai me opoiodhpote synh8ismeno EPROM burner.

4.2 Ftiaxnontas ena ws dir

Apla antigracte to protypo dir, dinontas :

cd /tftpbootcp -a template <ip>

Fysika, 8a mporousate apla n’ antigracete ta dirs twn ws’s me idio mouse, idia karta grafikwn kai idio monitor, kai na paraleicete tis ry8miseis sto bhma 5.4 .

4.3 Pros8etontas grammes sta /etc/bootptab kai /etc/hosts

Dior8wste to /etc/bootptab kai pros8este mia grammh gia ton ws twn dokimwn. Px, mia katallhlh grammh einai :

nfsroot1:hd=/tftpboot:vm=auto:ip=10.0.0.237:\
:ht=ethernet:ha=00201889EE78:\
:bf=bootImage:rp=/tftpboot/10.0.0.237/root

Antikatasthste to nfsroot1 me to onoma host, poy 8elete na exei o ws. Antikatasthste to 10.0.0.237 me to ip poy 8elete na exei o ws (kante to ayto 2 fores), kai antikatasthste to 00201889EE78 me thn antistoixh dieu8ynsh mhxanhs (ths kartas diktuoy) toy ws. An den gnwrizete th dieu8ynsh mhxanhs toy ws, apla ekkinhste ton me th disketa ekkinhshs poy molis ftiajate, kai cajte ton ari8mo ths dieu8ynshs mhxanhs anamesa sta mhnumata ekkinhshs. Yparxei mia pi8anothta to bootp na trexei hdh, synepws bebaiw8eite janajekinwntas to me :

killall -HUP bootpd

Mhn anhsyxeite an apotuxei ayto, ayto shmainei oti to bootp den etrexe. Epishs, mporei na to jekinhsei kai o inetd, an toy to zhthsoyme.

4.4 Ekkinwntas ton ws gia prwth fora

Apla jekinhste ton ws me th disketa. Ayth h diadikasia 8a prepei na dwsei enan ws poy doyleuei se text mode, me akribws tis idies ry8miseis toy server, ektos aytwn gia ta ip-nr kai tis services poy trexoyne. Akomh ki an 8elete na balete EPROM ekkinhshs, 8a htan ejypno prwta na dokimasete me th disketa. An doylecei h disketa, mporeite meta na dokimasete me thn EPROM. Gia perissotera, diabaste thn tekmhriwsh gia EPROMs ekkinhshs.

4.5 Kanontas tis eidikes gia ton ws ry8miseis.

Twra, hr8e h stigmh na kanoyme tis eidikes ry8miseis toy ws :

1. Prwta-prwta, gia na doylecei to mouse, apla trexoyme to mouseconfig. Gia na efarmosoyme tis allages kai na dokimasoyme an doyleuei to pontiki, dinoyme :

/etc/rc.d/init.d restart

2. Trexoyme to Xconfigurator. Otan ayto brei thn karta o8onhs kai sas zhthsei na pathsete ok, mhn to kanete! Afou exoyme metakinhsei to symlink toy Xserver apo to /etc/X11/X sto /etc/sysconfig/X11/X , to Xconfigurator den 8a ftiajei to swsto link. Etsi, gia na sigoyreytoume oti kai oi ypoloipes ry8miseis toy Xconfigurator 8a ginoyn swsta, gyrizoyme se mia allh konsola, kai ftiaxnoyme to link sto /etc/sysconfig/X11 gia ton sygkekrimeno server. Meta, apla teleiwnoyme me to Xconfigurator kai dokimazoyme ta X.

3. Ry8mizoyme o,tidhpote diaforetiko ap’ osa exei o server kai to protypo dir :

• Hxos : Pi8anotata 8a xreiastei n’ allajete ta isapnp.conf kai conf.modules, dioti kai ta duo (apo to script ry8misewn toy server) einai hdh etoima links pros to /etc/sysconfig .

• cd-rom : Ena link sto /dev, mia grammh sto /etc/fstab? , klp.

• rc.local : Kante opoiesdhpote aparaithtes allages.

4. Swste ta links kai opoies alles allages sto /dev . Dwste :

/etc/rc.d/rc.devfs save /etc/sysconfig

5. Ola etoima.

5 Pros8eto dwraki : Ekkinwntas apo cd-rom

Polla apo ta parapanw efarmozontai epishs se ekkinhsh apo cd-rom. Mia pou - etsi ki alliws - h8ela na gracw kai gia ekkinhsh apo cd-rom, pros8etw edw tis katallhles plhrofories, wste na mhn janagracw dyo fores ta idia pragmata.

Giati na 8eloyme na bootaroyme enan H/Y apo cd-rom; H ekkinhsh apo cd-rom mas endiaferei se periptwseis, opoy 8eloyme na trejoyme mia polu eidikh efarmogh, px ena kiosk (s.t.m. : Des to Kiosk HowTo), ena programma bashs dedomenwn biblio8hkhs, h ena intenet cafe, kai den exoyme diktyo h server, gia na kanoyme sthsimo root over nfs.

5.1 Basikh arxh

H basikh arxh pali einai aplh : na ekkinhsoyme ws root m’ ena cd-rom. Gia na mporesoyme : 8a xrhsimopoihsoyme thn epektash rockridge, gia na topo8ethsoyme ena unix-like filesystem epanw sto cd, kai thn epektash Eltorito, gia na kanoyme to cd ekkinhsimo.

5.1.1 Ta pragmata den mporei na einai toso apla

Fysika, ayto to sthsimo paroysiazei merika problhmata. Ta perissotera einai ta idia me ta parapanw :

1. 8a xreiastoume prosbash eggrafhs sta : /dev, /var & /tmp.

• 8a xrhsimopoihsoyme tis idies luseis, opws gia to root over nfs (des parapanw) :

– Gia to /dev , 8a xrhsimopoihsoyme to Devfs .

– Gia ta /var kai /tmp , 8a xrhsimopoihsoyme ena diamoirasmeno (shared) ramdisk toy 1 MB. To kanoyme shared, gia na xrhsimopoihsoyme ton xwro oso apotelesmatikotera ginetai. To /tmp antika8istatai m’ ena symlink pros to /var/tmp , gia na katasthsoyme dynato ton diamoirasmo.

– Doyleuei ej isoy kala to na gemisoyme to ramdisk me tarballs, h protypa (template) directories. Omws, einai polu eykolotero na kanoyme allages me ta protypa dirs, ara 8a xrhsimopoihsoyme ayta.

2. Merikes efarmoges xreiazontai prosbash eggrafhs sto /home.

• Balte sto /var ta home directories twn xrhstwn poy 8a trejoyn tis efarmoges aytes, kai gemiste ta me ta ypoloipa periexomena toy /var se ka8e epanekkinhsh.

3. To /etc/mtab prepei na mporei na grafetai :

• Ftiajete ena link pros to /proc/mounts kai dhmioyrghste ena adeio arxeio mounts sto /proc, opws parapanw.

5.2 Ftiaxnontas ena dokimastiko sthsimo.

Twra, poy gnwrizoyme ti na kanoyme kai pws, hr8e h stigmh na ftiajoyme ena dokimastiko sthsimo :

1. Kat’ arxhn, parte enan H/Y ap’ aytous poy 8elete na xrhsimopoihsete, kai balte mesa enan megalo sklhro disko ki ena cd recorder.

2. Balte to Linux poy sas aresei epanw s’ ayto to mhxanhma, ki afhste eleu8erh mia partition twn 650 MB gia to dokimastiko sthsimo. Ayth h egkatastash 8a fanei xrhsimh sto na ftiajoyme to iso-image toy cd kai na to rijoyme sta cd’s ekkinhshs, ara egkatasthste ta aparaithta ergaleia. Epishs, 8a mas xreiastei sto na dior8wsoyme ola ta bugs, poy den mas epitrepoyn na bootaroyme to mhxanhma ths dokimhs.

3. Egkatasthste to Linux ths epiloghs sas epanw sthn partition twn 650 MB, me to sthsimo poy 8elete na perasei kai sto cd. Ayto 8a einai kai to sthsimo poy 8a xrhsimopoihsoyme stis dokimes.

4. 3ekinhste apo th dokimastikh partition.

5. Kante compile enan pyrhna, opws perigracame sto tmhma 3.1 . Akoloy8hste ola ta bhmata, dioti oi aparaithtes allages gia to devfs ejakoloy8oun na xreiazontai! Sto bhma 3 toy tmhmatos 3.1, pros8este ta ejhs :

• isofs compiled mesa ston pyrhna

• devfs compiled mesa ston pyrhna

• yposthrijh cdrom compiled mesa ston pyrhna

• o,ti allo xreiazeste, eite compiled mesa ston pyrhna, eite ws module.

6. Ry8miste to dokimastiko sthsimo :

• Dhmioyrghste ton xrhsth, poy 8a trejei thn efarmogh.

• Balte to home directory toy sto /var.

• An xreiastei, egkatasthste thn efarmogh.

• An xreiastei, kante ry8miseis gia thn efarmogh.

• Kante tis ry8miseis toy sygkekrimenoy xrhsth, wste h efarmogh na trejei aytomata meta to login.

• Ry8miste to Linux, wste aytomata na kanei login gia ton xrhsth.

• Ry8miste o,tidhpote allo xreiazetai ru8mish.

7. Dokimaste to oti ola doyleuoyn swsta.

8. Ekkinhste thn kyriws egkatastash kai kante mount thn partition twn 650 MB sto directory /test ths kyriws egkatastashs.

9. Balte ta parakatw s’ ena arxeio, me to onoma /test/etc/rc.d/rc.iso . To source aytou toy arxeioy mpainei sthn arxh toy rc.sysinit, gia na ftiajei to /var .

#/var
echo Ftiaxnoume to /var ...
mke2fs -q -i 1024 /dev/ram1 1024
mount /dev/ram1 /var -o defaults,rw
cp -a /lib/var /
#Epanaferoume tis ry8miseis tou devfs, xreiazomaste to proc
mount -t proc /proc /proc
/etc/rc.d/rc.devfs restore /etc/sysconfig
umount /proc

10. Dior8wnoyme to /test/etc/rc.sysinit , bazontas sxolio stis grammes opoy o root fortwnetai rw, kai pros8etoyme tis akoloy8es 2 grammes amesws meta ton orismo toy PATH :

#gia na bootaroume apo cdrom
. /etc/rc.d/rc.iso

11. Antigrafoyme ta parakatw s’ ena script kai to ekteloume. Ayto 8a ftiajei ena protypo gia to /var kai 8a dhmioyrghsei ta links twn /tmp kai /etc/mtab.

#!/bin/sh
echo tmp
rm -fR /test/tmp
ln -s var/tmp /test/tmp
###
echo mtab
touch /test/proc/mounts
rm /test/etc/mtab
ln -s /proc/mounts /test/etc/mtab
###
echo var
mv /test/var/lib /test/lib/var-lib
mv /test/var /test/lib
mkdir /test/var
ln -s /lib/var-lib /test/lib/var/lib
rm -fR /test/lib/var/catman
rm -fR /test/lib/var/log/httpd
rm -f /test/lib/var/log/samba/*
for i in `find /test/lib/var/log -type f`; do cat /dev/null > $i; done
rm `find /test/lib/var/lock -type f`
rm `find /test/lib/var/run -type f`

12. Afairwntas th dhmioyrgia toy /etc/issue* apo to /test/etc/rc.local, apla 8a to anagkasoyme na apotuxei.

13. Twra epanekkinoume th dokimastikh partition, h opoia 8a diabastei apla san ena cd-rom. An kati den doylecei, epanekkinhste me thn kyriws partition, dior8wste to, janadokimaste to, k.o.k. . H, mporeite na kanete remount / rw th dokimastikh partition, na to dior8wsete, kai na epanekkinhsete katey8eian me th dokimastikh partition jana. Gia na kanete remount / rw , dwste :

mount -o remount,rw /

5.3 Ftiaxnontas to cd

5.3.1 Ftiaxnontas ena boot image

Prwta-prwta, ekkinhste me thn kyriws partition. Gia na ftiajete ena ekkinhsimo cd, 8a xreiasteite ena image mias bootable disketas. Den 8a doylecei to aplo dd s’ ena zimage, epeidh o loader sthn arxh toy zimage den fainetai n’ agapaei thn ceutikh disketa, poy dhmioyrgei to ekkinhsimo cd. Etsi, 8a xrhsimopoihsoyme to syslinux :

1. Pairnoyme to boot.img apo ena cd toy RedHat

2. Kanoyme mount to boot.img kapoy anamesa sto loopback, dinontas :

mount boot.img kapou -o loop -t vfat

3. Afairoume o,tidhpote apo to boot.img , ektos apo ta :

• ldlinux.sys

• syslinux.cfg

4. Antigrafoyme to kernel image ths dokimastikhs partition sto boot.img .

5. Dior8wnoyme to syslinux.cfg , wste na periexei ta ejhs (antika8istwntas, fysika, to zImage me to katallhlo onoma image) :

  default linux
  label linux
  kernel zImage
  append root=/dev/<balte edw to onoma tou cdrom sas>

6. Umount boot.img:

umount kapou

7. An to /etc/mtab sas einai link gia to /proc/mounts , to umount den 8’ afhsei aytomata eleu8ero to

/dev/loop0 , synepws eley8erwste to dinontas :

losetup -d /dev/loop0

5.3.2 Dhmioyrgwntas to iso image Afou exoyme to boot image kai mia egkatastash poy mporei na jekinhsei apo ena readonly mount, eftase h stigmh na ftiajoyme ena iso image toy cd :

1. Antigracte to boot.img sto /test

2. Kante cd sto directory, opoy 8elete n’ apo8hkeusete to image. Bebaiw8eite oti brisketai epanw se mia partition me arketo eleu8ero xwro.

3. Twra, ftiajte to image, plhktrologwntas :

mkisofs -R -b boot.img -c boot.catalog -o boot.iso /test 5.3.3 Epalh8euontas to iso image

1. Kante mount to image anamesa sto loopback device, dinontas :

mount boot.iso kapou -o loop -t iso9660

2. Twra epibebaiwste oti ta periexomena einai entajei.

3. Kante umount to boot.iso :

umount kapou

4. An to /etc/mtab sas einai link pros to /proc/mounts , to umount den 8’ apeley8erwsei aytomata to

/dev/loop0 . Ayto eley8erwste to, plhktrologwntas :

losetup -d /dev/loop0

5.3.4 Grafontas to CD Ypo8etontas oti exete egkatasthsei kai ry8misei to cdrecord gia ton eggrafea sas, dwste :

cdrecord -v speed=<epi8umhth taxuthta eggrafhs> dev=<path pros to generic scsi device tou eggrafea sas> boot.iso

5.4 Bootarete to CD kai dokimaste to

E, o titlos ayths ths paragrafoy ta leei ola! ;)

6 Eyxaristw

• To HHS (Haagse Hoge School), ena Ollandiko kolegio, opoy gia prwth fora esthsa kai dokimasa ayto to sxhma se kanadyo ergasthria. Kai opoy grafthke h arxikh ekdosh aytou toy HowTo.

• Thn ISM, mia Ollandikh etairia, opoy ergazomai sto teliko moy project. Ena meros toy project exei na kanei me diskless H/Y, ara eprepe na cajw perissotero to sygkekrimeno sthsimo toy diktuoy, kai eixa ton xrono n’ ana8ewrhsw ayto edw to HowTo.

• Oloys toys xrhstes poy 8a moy dwsoyn xrhsimes ypodeijeis, apo th stigmh poy ayth edw h prwth ekdosh 8a dei to fws ths dhmosiothtas. ;)

7 Sxolia

Sxolia, ypodeijeis, klp einai eyprosdekta. Mporeite na ta steilete ston Hans de Goede, sto : j.w.r.degoede@et.tudelft.nl