在ubuntu804上安装kerrighed230 cluster.docx
《在ubuntu804上安装kerrighed230 cluster.docx》由会员分享,可在线阅读,更多相关《在ubuntu804上安装kerrighed230 cluster.docx(18页珍藏版)》请在冰豆网上搜索。

在ubuntu804上安装kerrighed230cluster
在ubuntu8.04上安装kerrighed2.3.0cluster
参考原文:
SettingUpADiskless-bootKerrighed2.4.1ClusterinUbuntu8.04
本实验中用了三台机器,一台作为server(运行Ubuntu8.04,内核任意),另外两台作为client。
Server不需要安装Kerrighed内核,他只作为服务器,为Client节点提供网络以及文件系统等支持。
Server通过DHCP、TFTP服务为Client进行网络安装操作系统,并通过NFS为Client提供全局文件系统支持。
Server有两个网卡,一个对外,一个对内。
本实验中对外的网卡为eth1,其IP与本实验无关;对内的网卡为eth0,其IP为192.168.1.1,子网掩码为255.255.255.0。
这个安装向导分为两个部分:
第一部分是配置服务器,让节点可以使用当前的kernel无盘启动;第二部分是安装与配置Kerrighed2.3.0。
为了简单,本文大多内容直接原文拷贝,所以是英文,个别地方做了修改,或采用中文说明。
另外,重要的补充说明用红字体标示。
Part1:
建立无盘启动的Ubuntuserver
Thiswillbethebasisofourcluster.Inordertogetaworkingdisklessbootserver,therearefourmaincomponentsyou'llneedtoinstall:
aDHCPservertoassignIPaddressestoeachnode,aTFTPservertobootthekernelforeachnodeoverthenetwork,anNFSservertoallowthenodestoshareafilesystem,andaminimalUbuntu8.04installationforthemtoshare.
Theseservercomponentswillallrunononebox;thisboxwillbeyour'headnode'orthecontrollerforthecluster.Let'sgetstarted!
1.1:
SettinguptheDHCPserver
DHCPiswhatwillallowthenodestogetIPaddressesfromtheserver.WewanttosetupandconfigureaDHCPdaemontorunontheserverandgiveIPaddressesonlytonodesitrecognises,sowewilltellthedaemontheirMACaddresses.
FirstinstalltheDHCPserverpackagewithaptitudeorapt-get,asroot:
#aptitudeinstalldhcp3-server
补充说明:
从此处开始,后续会有很多操作涉及aptitudeinstall或者apt-getinstall,这些都需要联网操作。
那么,在无法上网的情况下,如何安装这些软件呢?
一种相对简单的方式是:
一次性的把所有的软件安装在另一台上网机上,然后拷贝这些软件到非上网机。
此次实验采取的即是这种方法,详细说明见附录一。
当然,也可以在本地局域网配置一个软件源,只要添加这个源即可,但源非常庞大,下载较麻烦,暂时未使用该方法。
修改内网卡的IP为192.168.1.1,掩码为255.255.255.0,网关为192.168.1.0,DNS为192.168.1.1。
CheckthattheDHCPserverconfigurationfile,/etc/default/dhcp3-server,containsthecorrectEthernetcardtolistentoDHCPrequestsfromthenodes:
thiswillbethecardthatdoesnotconnecttotheInternet.Ifyouputthewrongcardintothisfile,badthingswillhappen:
yourserverwillstartlisteningtoDHCPrequestsontheLANanddenyingthemall,sincetheydon'tcomefromnodes.Makesureyouknowwhichistherightcard!
=]Inthiscaseitiseth0,somaketheconfigurationfilelooklikethis:
#/etc/default/dhcp3-server#
interfaces="eth0"
NowyouneedtoconfiguretheDHCPdaemontoissueaddressesonlytonodes,andtellitwhichaddressestogivethem.MakesureyouhavetheMACaddressesofyournodes'Ethernetcardshandy-youcangetthembyissuingthecommandifconfigasrootfromaliveDVDorUSBstick,forinstance,ortheymaybewrittenonthenodes'casingoronstickersstucktothecards.Youcanalsojustboottheclusterandwatchtheerrormessages,pickingouttheMACsfromthedeniedrequests.Edit/etc/dhcp3/dhcpd.conf,DHCP'sdaemonconfigurationfile,soitlookslikethefollowing.(Don'tworrythatthefilereferencescertainthingsyouhaven'tactuallyinstalledyet,likeaPXEbootloader;you'llputthesethingsinlater.)
#/etc/dhcp3/dhcpd.conf#
#Generaloptions
optiondhcp-max-message-size2048;
use-host-decl-nameson;
denyunknown-clients;#Thiswillstopanynon-nodemachinesfromappearingontheclusternetwork.
denybootp;
#DNSsettings
optiondomain-name"kerrighed";#Justanexamplename-callitwhateveryouwant.
optiondomain-name-servers192.168.1.1;#Theserver'sIPaddress,manuallyconfiguredearlier.
#Informationaboutthenetworksetup
subnet192.168.1.0netmask255.255.255.0{
optionrouters192.168.1.1;#ServerIPasabove.
optionbroadcast-address192.168.1.255;#Broadcastaddressforyournetwork.
}
#DeclaringIPaddressesfornodesandPXEinfo
group{
filename"pxelinux.0";#PXEbootloader.Pathisrelativeto/var/lib/tftpboot
optionroot-path"192.168.1.1:
/nfsroot/kerrighed";#LocationofthebootablefilesystemonNFSserver
hostkerrighednode1{
fixed-address192.168.1.101;#IPaddressforthefirstnode,kerrighednode1forexample.
hardwareethernet01:
2D:
61:
C7:
17:
86;#MACaddressofthenode'sethernetadapter
}
hostkerrighednode2{
fixed-address192.168.1.102;
hardwareethernet01:
2D:
61:
C7:
17:
87;
}
server-name"kerrighedserver";#Nameoftheserver.Callitwhateveryoulike.
next-server192.168.1.1;#ServerIP,asabove.
}
Nowyou'redoneconfiguringDHCP,soyournodeswillbeabletogetIPs.It'stimetoaddthefunctionalitythatwillallowtheservertotransferakerneltothemafterwards.
1.2:
SettinguptheTFTPserverandPXEbootloader
TFTPisthefileserverthatwillbeusedbythebootloadertotransferthekerneltoyournodesduringaPXEboot.WeneedtoinstallaTFTPserverandgetaPXEbootloaderaspartofthesyslinuxpackage,sothatournodeswillbeabletogettheiroperatingsystemsviatheclusterserver.
Asroot,installtheTFTPserverpackage,tftp-hpa,withaptitudeorapt-get:
#aptitudeinstalltftpd-hpa
Openitsconfigurationfile,/etc/default/tftpd-hpa,andmakesureitusesthefollowingsettings.Itcanberunasadaemon,butitisnormallystartedbytheservicedaemon"inetd",anditusesthe/var/lib/tftpbootdirectorytogetfilesfrom:
#/etc/default/tftp-hpa#
#Defaultsfortftp-hpa
RUN_DAEMON="yes"
OPTIONS="-l-s/var/lib/tftpboot"
Nowweneedtoconfigureinetdtorunthetftpserver.Openitsconfigurationfile,/etc/inetd.conf,andchangethetftplinetothefollowing.Ifthereisnotftpline,addthis:
tftpdgramudpwaitroot/usr/sbin/in.tftpd/usr/sbin/in.tftpd-s/var/lib/tftpboot
Asroot,installsyslinux,whichisthesystemrequiredforyoutobeabletoPXEbootthenodes,andcopythePXEbootloadercodefromittotheTFTPserverdirectory.ThisisthebootloaderyoutoldtheDHCPdaemonaboutinitsconfigurationfileearlier.
#aptitudeinstallsyslinux
#cp/usr/lib/syslinux/pxelinux.0/var/lib/tftpboot
Stillasroot,createadirectorytostorethedefaultconfigurationforallthenodes.TheywillsearchinthisdirectoryforconfigurationfilesduringthePXEbootprocess.
#mkdir/var/lib/tftpboot/pxelinux.cfg
Stillasroot,copyyourcurrentkernelandinitrdfrom/bootto/var/lib/tftpboot/inordertotestthediskless-bootsystem.Ifneed,replace`uname-r`withwhateveryouareusing.
#cp/boot/vmlinuz-`uname-r`/boot/initrd.img-`uname-r`/var/lib/tftpboot/
Createthefile/var/lib/tftpboot/pxelinux.cfg/default.ThiswillbethefallbackconfigurationfilethatthenodesusetoPXEbootwhentheycan'tfindafilespecifictotheirownIPaddress.Makethefilelooklikethis:
LABELlinux
DEFAULTvmlinuz-`uname-r`console=tty1root=/dev/nfsinitrd=initrd.img-`uname-r`nfsroot=192.168.1.1:
/nfsroot/kerrighedip=dhcprw
You'redonesettinguptheTFTPandPXEcomponentsoftheclusterserver!
Yournodeswillnowbeabletogetakernelandfilesystemfromtheserverafterthey'regivenIPaddresses.NowyouneedtoaddNFScapability.
1.3:
SettinguptheNFSserver
ThiscapabilityallowsforthebootablefilesystemthatthenodeswilldownloadoverTFTPtobeaccessedandsharedoverthenetwork,sothattheclusterusesonefilesystem.Firstwe'llinstallandsetuptheserverthatwilldothis.
Asroot,installthepackagesnfs-kernel-serverandnfs-common,whichcomprisetheNFSserverprogram.Keepyourrootauthorisationuntilyou'redoneworkingwiththeNFSserver.
#apt-getinstallnfs-kernel-servernfs-common
Makeadirectorytostorethebootablefilesystemin:
#mkdir/nfsroot
#mkdir/nfsroot/kerrighed
Edit/etc/exports,whichconfiguresNFSfiletransfers.AddthefollowinginordertomakeNFSexportthefilesystemthatwillbestoredinthedirectoryyoujustmade:
#/etc/exports#
/nfsroot/kerrighed192.168.1.0/255.255.255.0(rw,no_subtree_check,async,no_root_squash)
Re-exportthefilesystems,sinceyoujustchangedhowthisisdone:
#exportfs-avr
YourNFSservershouldbeupandrunning.Nowyoucanaddafilesystemforthisservertoworkwith.
1.4:
Settingupthebootablefilesystem
Thisisn'tassimpleasjustcopyingtheOSfilesintoanotherdirectory-you'llneedthedebootstrappackagetoinstallthebootable
filesystem,soinstallthisfirst(youshouldstillberoot.)Onceit'sinstalled,usedebootstraptoitselfinstallaminimalUbuntuHardysystemto
thebootablefilesystemdirectory:
#aptitudeinstalldebootstrap
#debootstrap--archi386hardy/nfsroot/kerrighed
补充说明:
此处需要联网下载一个完整的ubuntu8根系统,对于不能联网的机器,解决方法如下。
在联网的机器上安装ubuntu8.04的虚拟机,建立/nfsroot/kerrighed目录后执行以上命令,成功后该目录下将会有一个完整的根目录,拷贝这个目录(最好先压缩再拷贝,防止数据丢失)到非联网机器的相应目录即可。
在本实验中,由于后续还要apt-getinstall一些软件,这些也需要联网,所以应当在联网机上执行完这些所有需要联网的操作之后,再拷贝整个目录到非联网机上。
当然,此时在非联网机上就可以掠过这些步骤了,这些需要在联网机上操作的后续步骤如下:
Edit/etc/apt/sources.list.
#aptitudeupdate
$apt-getinstalldhcp3-commonnfs-commonnfsbootedopenssh-server
$apt-getinstallautomakeautoconflibtoolpkg-configgawkrsyncbzip2gcc-3.3libncurses5libncurses5-devwgetlsb-releasexmltopatchutilsxutils-devbuild-essentialopenssh-serverntp
Changethecurrentrootofthefilesystemtothebootablefilesystemdirectory(staychrooteduntiltheguidetellsyouotherwise.)Thisissothatyoucanworkwiththebootablefilesystemdirectly,asifitwereaseparatemachine,whilewemakesomeadjustmentstoit.
#chroot/nfsroot/kerrighed
Settherootpasswordforthebootablefilesystem.Youcanuseaprogramcalledapg,theautomatedpasswordgenerator,tocreateagoodone.
#passwd
Mountthe/procdirectoryofthecurrentmachineasthebootablesystem's/procdirectory,soyoucanuseprogramsonthebootableFS:
#mount-tprocnone/proc
Edit/etc/apt/sources.list.WewanttoaddaccesstosomeextraUbunturepositoriesinordertobeabletodownloadthenecessarypackagesfortheFS.Addtheselines:
debhttp:
//archive