Next Previous Contents

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 :
  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..
  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) :

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

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

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
 

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 :

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.

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 .

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

Next Previous Contents