搭建HPC超詳細(xì)教程_第1頁(yè)
搭建HPC超詳細(xì)教程_第2頁(yè)
搭建HPC超詳細(xì)教程_第3頁(yè)
搭建HPC超詳細(xì)教程_第4頁(yè)
搭建HPC超詳細(xì)教程_第5頁(yè)
已閱讀5頁(yè),還剩56頁(yè)未讀, 繼續(xù)免費(fèi)閱讀

下載本文檔

版權(quán)說(shuō)明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請(qǐng)進(jìn)行舉報(bào)或認(rèn)領(lǐng)

文檔簡(jiǎn)介

1、.集群架設(shè)鐘毅 廈門大學(xué)物理學(xué)系復(fù)雜系統(tǒng)研究室 2012年8月前言集群就是一堆計(jì)算機(jī)通過(guò)某種方式聯(lián)系在一起的統(tǒng)一的整體.它有一個(gè)主節(jié)點(diǎn),負(fù)責(zé)管理賬戶,回答用戶的請(qǐng)求,以及命令其它計(jì)算機(jī)即子節(jié)點(diǎn)(計(jì)算節(jié)點(diǎn))完成某項(xiàng)任務(wù). 為了能夠給子節(jié)點(diǎn)下命令,我們必須搭建SSH服務(wù),并且要達(dá)到無(wú)密碼互訪(因?yàn)樽庸?jié)點(diǎn)要反饋計(jì)算結(jié)果或者其它信息給主節(jié)點(diǎn));為了管理用戶賬號(hào)的方便,我們要建立NIS服務(wù),而要建立NIS服務(wù),又必須先搭建NFS服務(wù). NFS服務(wù)的一項(xiàng)重要的功能是,把主節(jié)點(diǎn)的某個(gè)或者某些目錄共享給子節(jié)點(diǎn),這樣,只要在主節(jié)點(diǎn)的共享區(qū)域安裝了某個(gè)軟件,那么該軟件就可以被所有子節(jié)點(diǎn)利用.我們復(fù)雜系統(tǒng)小組的成員

2、都喜歡編寫Fortran程序,所以我們有必要安裝Fortran編譯器-ifort軟件,這是intel公司提供的免費(fèi)Fortran編譯器.又考慮到我們經(jīng)常要進(jìn)行大規(guī)模模擬計(jì)算,這就必須安裝MPICH2這個(gè)并行計(jì)算軟件. 此外,我們還必須安裝Torque這個(gè)作業(yè)管理器,對(duì)用戶提交的作業(yè)進(jìn)行管理.有必要說(shuō)明的是,這里展示的是每種軟件的安裝步驟,以及遇到問(wèn)題時(shí)的處理方法;這里面沒(méi)有對(duì)各種軟件的功能進(jìn)行詳細(xì)的解說(shuō)喲,也沒(méi)有對(duì)linux的命令進(jìn)行解說(shuō),要知道它們的功能,請(qǐng)參看最后面列出的參考文獻(xiàn)吧. 還有一點(diǎn)必須說(shuō)明,之所以整理這個(gè)安裝筆記,是為了讓師弟師妹們?cè)谧约杭茉O(shè)集群的時(shí)候有一份比較完整的參考資料.

3、 好了,廢話少說(shuō),開(kāi)始動(dòng)手吧,O(_)O哈哈 一安裝與連接internet兩臺(tái)電腦Hostname分別為centos1,centos21. 安裝CentOS6.3 , 分區(qū)的時(shí)候選擇如下方式centos1的分區(qū):/ : 90GB/var : 10GB/tmp : 10GBSwap : 3GB/disk1 : 20GBcentos2的分區(qū):/ : 20GB/var : 10GB/tmp : 10GBSwap : 3GB/disk2 : 90GB選擇安裝basic server 的安裝包。2. 連接internet以root 用戶登錄,然后分別做如下的事情a. 設(shè)IProotcentos1 # v

4、i /etc/sysconfig/network-scripts/ifcfg-eth0DEVICE=eth0BOOTPROTO=staticBROADCAST=55HWADDR=00:26:2D:D0:69:18IPADDR=07NETMASK=GATEWAY=NM_CONTROLLED=yesONBOOT=yesTYPE=EthernetUUID=001bde85-8379-4fcc-9b4e-8f98260f5893以上涂了顏色的為新加的b. 啟動(dòng)網(wǎng)卡rootcentos1 # ifup eth0rootcent

5、os1 # /etc/init.d/network restartc. 看是否正常啟動(dòng)了rootcentos1 # ifconfig eth0eth0 Link encap:Ethernet HWaddr 00:26:2D:D0:69:18 inet addr:07 Bcast:55 Mask: inet6 addr: 2001:da8:e800:100:226:2dff:fed0:6918/64 Scope:Global inet6 addr: fe80:226:2dff:fed0:6918/64 Scope:Link UP BROA

6、DCAST RUNNING MULTICAST MTU:1500 Metric:1 RX packets:747 errors:0 dropped:0 overruns:0 frame:0 TX packets:34 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:1000 RX bytes:81563 (79.6 KiB) TX bytes:4544 (4.4 KiB) Interrupt:18出現(xiàn)IP了就是正常啟動(dòng)了。d. 設(shè)置DNS的IProotcentos1 # vi /etc/resolv.confnam

7、eserver nameserver 0e. 檢查是否能夠解析域名了rootcentos1 # nslookup Server: Address: #53Non-authoritative answer: canonical name = .Name: Address: 47出現(xiàn)IP了就是設(shè)置成功了。f. 調(diào)整時(shí)間,設(shè)置成現(xiàn)在的時(shí)間rootcentos1 # date -s 07/26/2012Thu Jul 26 00:00:00 CST 2012rootcentos1 # date

8、 -s 17:10:15Thu Jul 26 17:10:15 CST 2012rootcentos1 # clock wg. 對(duì)于centos2 重復(fù)以上步驟就可以了?,F(xiàn)在就可以坐在某一臺(tái)WIN7電腦前,用putty 同時(shí)登錄兩臺(tái)電腦了。centos1 的 IP :07centos2 的 IP :08二兩臺(tái)電腦間(即節(jié)點(diǎn)間)創(chuàng)建SSH信任連接1. 在centos1 與 centos2中分別建立可以信任的主機(jī)的Hostname與它的IP的對(duì)應(yīng) a. rootcentos1 # vi /etc/hosts localhost59.77.3

9、6.207 centos08 centos2rootcentos1 # hostnamecentos1rootcentos1 # hostname -i07 b. rootcentos2 # vi /etc/hosts localhost08 centos207 centos1rootcentos2 # hostnamecentos2rootcentos2 # hostname -i082. 我們的目標(biāo)是a) 在節(jié)點(diǎn)centos1和centos2中有相同的用戶,以及相同的用戶

10、賬號(hào)密碼b)可以在任意一節(jié)點(diǎn)上直接用當(dāng)前的賬號(hào)登陸到其它節(jié)點(diǎn)上去,而不用密碼(A)如果兩臺(tái)主機(jī)之間沒(méi)有建立NFS與NIS服務(wù),則執(zhí)行下面的步驟:1)用root賬戶把centos1(主結(jié)點(diǎn))上的 /etc/passwd, /etc/shadow/, /etc/group/, /etc/gshadow/ 復(fù)制到其它節(jié)點(diǎn)上去。(rootcentos1 #scp /etc/passwd :/etc/passwd ).2) 執(zhí)行以下命令在centos1中以cv登陸,a. cvcentos1 $ ssh-keygen -t rsaGenerating public/private rsa key pair

11、.Enter which to save the key (/home/cv/.ssh/id_rsa):Created directory /home/cv/.ssh.Enter passphrase (empty for no passphrase):Enter same passphrase again:Your identification has been saved in /home/cv/.ssh/id_rsa.Your public key has been saved in /home/cv/.ssh/id_rsa.pub.上面涂了顏色的后面直接用回車就可以。b.cvcento

12、s1 $ ls -aldrwx-. 2 cv cv 4096 Jul 27 16:30 .sshc.cvcentos1 .ssh$ ls al-rw-. 1 cv cv 1675 Jul 27 16:30 id_rsa-rw-r-r-. 1 cv cv 392 Jul 27 16:30 id_rsa.pub在centos2中以cv登陸,重復(fù)以上步驟,最后cvcentos2 .ssh$ ls -al-rw-. 1 cv cv 1679 Jul 27 16:30 id_rsa-rw-r-r-. 1 cv cv 392 Jul 27 16:30 id_rsa.pub就是說(shuō)在centos1與cento

13、s2中的 /home/cv/.ssh/目錄下,都產(chǎn)生了私匙id_rsa 與公匙id_rsa.pub。我們應(yīng)該把這兩個(gè)公匙的內(nèi)容集中起來(lái),放入同一個(gè)文件authorized_keys中,然后把這個(gè)文件再分別放入centos1與centos2中的 /home/cv/.ssh/目錄下,并且改變權(quán)限:chmod 600 authorized_keys 然后就可以了。用到的命令為(要按順序進(jìn)行操作)cvcentos2 .ssh$ cp id_rsa.pub authorized_keyscvcentos1 .ssh$ scp id_rsa.pub cvcentos2:/home/cv/cvcentos2

14、 $ cat id_rsa.pub ./.ssh/authorized_keyscvcentos2 .ssh$ scp authorized_keys cvcentos1:/home/cv/.ssh/然后,在centos2上cvcentos2 .ssh$ ssh centos1Last login: Fri Jul 27 16:48:12 2012 from centos2cvcentos1 $在centos1上cvcentos1 .ssh$ ssh centos2Last login: Fri Jul 27 16:29:53 2012 from 39cvcentos2 $

15、可見(jiàn),已經(jīng)不用密碼就相互登錄了。(B) 如果兩臺(tái)主機(jī)之間已經(jīng)建立NFS與NIS服務(wù),則執(zhí)行下面的步驟:1)用root 用戶登錄主節(jié)點(diǎn),然后執(zhí)行以下命令root # useradd -g complex -m chong01(注:新增用戶chong01,強(qiáng)制建立/home/chong01目錄)root # passwd chong01New UNIX password:Retype new UNIX password:passwd: password updated successfullyroot # /usr/lib/yp/ypinit m (注:這里是更新主節(jié)點(diǎn)上的NIS數(shù)據(jù)庫(kù),讓子節(jié)點(diǎn)也

16、認(rèn)識(shí)新用戶)At this point, we have to construct a list of the hosts which will run NISservers. BlueMoon3 is in the list of NIS server hosts. Please continue to addthe names for the other hosts, one per line. When you are done with thelist, type a . next host to add: BlueMoon3 next host to add: (注:這邊直接按ctr

17、l+d組合鍵)The current list of NIS servers looks like this:BlueMoon3Is this correct? y/n: y yWe need a few minutes to build the databases.Building /var/yp/complexlab/ypservers.2)用新建立的賬號(hào)chong01登錄主節(jié)點(diǎn),執(zhí)行以下命令chong01 $ ssh-keygen -t rsaGenerating public/private rsa key pair.Enter which to save the key (/home

18、/chong01/.ssh/id_rsa):Enter passphrase (empty for no passphrase):Enter same passphrase again:open /home/chong01/.ssh/id_rsa failed: Permission denied.(注:權(quán)限不夠)Saving the key failed: /home/chong01/.ssh/id_rsa.chong01 $ ls -aldrw- 2 chong01 complex 4096 2012-07-27 16:58 .ssh/-rw-r-r- 1 chong01 complex

19、181 2012-07-27 16:58 .vimrcchong01 $ chmod +x .ssh (注:修改權(quán)限)chong01 $ ssh-keygen -t rsaGenerating public/private rsa key pair.Enter which to save the key (/home/chong01/.ssh/id_rsa):Enter passphrase (empty for no passphrase):Enter same passphrase again:Your identification has been saved in /home/chon

20、g01/.ssh/id_rsa.Your public key has been saved in /home/chong01/.ssh/id_rsa.pub.The key fingerprint is:ee:ce:2e:27:07:ec:4d:28:09:32:9c:4e:5f:bf:a6:2e chong01BlueMoon3chong01 $ cd .sshchong01 .ssh$ ls -al-rw- 1 chong01 complex 1675 2012-07-27 17:01 id_rsa-rw-r-r- 1 chong01 complex 399 2012-07-27 17:

21、01 id_rsa.pubchong01 .ssh$ cp id_rsa.pub authorized_keys (注:這一步非常重要)chong01 .ssh$ ssh anna01The authenticity of host anna01 () cant be established.RSA key fingerprint is 06:21:14:d4:02:f2:3f:d3:40:67:13:d6:32:c2:7c:2e.Are you sure you want to continue connecting (yes/no)? yesWarning: Pe

22、rmanently added anna01, (RSA) to the list of known hosts.Last login: Fri Jul 27 11:04:31 2012 from bluemoon3chong01anna01 $可見(jiàn),已經(jīng)可以無(wú)密碼登錄子節(jié)點(diǎn)anna01了。說(shuō)明:1)主節(jié)點(diǎn)上架設(shè)了NFS與NIS服務(wù),子節(jié)點(diǎn)把主節(jié)點(diǎn)的/home掛載到自己的/home目錄上;所以當(dāng)主節(jié)點(diǎn)上新增用戶時(shí),要重新建立數(shù)據(jù)庫(kù);同時(shí),由于SSH以無(wú)密碼方式登錄別的節(jié)點(diǎn)時(shí),是比較兩個(gè)節(jié)點(diǎn)的$HOME/.ssh/目錄下面文件authorized_keys里面的內(nèi)容,所

23、以這個(gè)文件一定要建立;又由于主節(jié)點(diǎn)與子節(jié)點(diǎn)共用/home,因此只要建立這個(gè)文件且把公匙放進(jìn)去就能無(wú)密碼訪問(wèn)了。特別注意,NIS的作業(yè)在于,主節(jié)點(diǎn)與所有子節(jié)點(diǎn)上的賬號(hào)密碼都是一樣的。2) 權(quán)限問(wèn)題最重要。比如用chongyi登錄:chongyicentos1 $ ls al drwx-. 2 chongyi chongyi 4096 Jul 27 15:41 .sshdrwx-. 2 root root 4096 Jul 28 10:07 test (即/home/chongyi/下有屬于root的目錄test)chongyicentos1 $ cd test-bash: cd: test: P

24、ermission denied (即chongyi無(wú)權(quán)限進(jìn)入test目錄)chongyicentos1 $ chmod 777 testchmod: changing permissions of test: Operation not permitted (即chongyi無(wú)權(quán)修改test目錄的權(quán)限)chongyicentos1 $ su - (用戶切換成root)Password:rootcentos1 # cd /home/chongyirootcentos1 chongyi# ls -aldrwx-. 2 chongyi chongyi 4096 Jul 27 15:41 .sshd

25、rwx-. 2 root root 4096 Jul 28 10:07 testrootcentos1 chongyi# chown -R chongyi:chongyi test (把test的賬號(hào)與用戶組都改為chongyi)rootcentos1 chongyi# ls -aldrwx-. 2 chongyi chongyi 4096 Jul 27 15:41 .sshdrwx-. 2 chongyi chongyi 4096 Jul 28 10:07 test (目錄test已經(jīng)屬于chongyi)rootcentos1 chongyi# su - chongyichongyicent

26、os1 $ ls -aldrwx-. 2 chongyi chongyi 4096 Jul 27 15:41 .sshdrwx-. 2 chongyi chongyi 4096 Jul 28 10:07 testchongyicentos1 $ cd testchongyicentos1 test$ (chongyi可以進(jìn)入test目錄)chongyicentos1 test$ cd .chongyicentos1 $ ls -aldrwx-. 2 chongyi chongyi 4096 Jul 27 15:41 .sshdrwx-. 2 chongyi chongyi 4096 Jul 2

27、8 10:07 testchongyicentos1 $ chmod u-x test (test目錄去掉x的權(quán)限)chongyicentos1 $ ls -aldrwx-. 2 chongyi chongyi 4096 Jul 27 15:41 .sshdrw-. 2 chongyi chongyi 4096 Jul 28 10:07 testchongyicentos1 $ mkdir ./test/test2mkdir: cannot create directory ./test/test2: Permission denied (無(wú)x權(quán)限后無(wú)法在test目錄下新建東西)chongyi

28、centos1 $ chmod u+x test (test目錄加上x(chóng)的權(quán)限)chongyicentos1 $ ls -aldrwx-. 2 chongyi chongyi 4096 Jul 27 15:41 .sshdrwx-. 2 chongyi chongyi 4096 Jul 28 10:07 testchongyicentos1 $ mkdir ./test/test2 (在test目錄下新建目錄test2)chongyicentos1 $ cd testchongyicentos1 test$ ls -aldrwxrwxr-x. 2 chongyi chongyi 4096 Jul

29、 28 10:25 test2 (在test目錄下成功建立了目錄test2)分析下面的權(quán)限:drwxr-xr-. 2 cv complex 4096 Jul 28 10:25 test9d:代表test9是目錄test9屬于用戶cv的,test9屬于complex組的cv對(duì)test9的權(quán)限為rwxcomplex組的成員對(duì)test9的權(quán)限為r-x其它別的用戶,別的組的成員對(duì)test9的權(quán)限為r-3)安裝套件或者執(zhí)行過(guò)程中遇到問(wèn)題時(shí),首先檢查文件或者目錄的所有者以及所在的用戶組,看它們的權(quán)限是什么;其次,要檢查該文件或者目錄的權(quán)限是不是套件所允許的,比如上面的authorized_keys ,SS

30、H只允許它的權(quán)限是600時(shí),才可以使用SSH無(wú)密碼互訪;再次,要檢查該文件或者目錄的所有者以及所在的用戶組是不是套件所允許的,比如PBS作業(yè)管理系統(tǒng)就是不允許root提交作業(yè);當(dāng)然,還要檢查防火墻中是否開(kāi)了套件需要的端口,以及套件之間相互依賴的套件是否有啟動(dòng)等等。4)在添加新用戶時(shí),要強(qiáng)制建立用戶home目錄,所以u(píng)seradd命令要用-m參數(shù);另外在刪除用戶時(shí),一定要連同用戶的家目錄一起刪除,如userdel r username ,不然的話,刪除一個(gè)用戶后,再添加一個(gè)新的用戶時(shí),有的系統(tǒng)會(huì)把這個(gè)新用戶安排在被刪除用戶的家目錄中,這樣會(huì)產(chǎn)生一堆的權(quán)限問(wèn)題。三建立NFS服務(wù)建立之前要明確幾件事

31、:1) NFS服務(wù)器端與NFS客戶端的賬號(hào)關(guān)系a. 每個(gè)賬號(hào)都分配有UID與GID,這個(gè)可以通過(guò)/etc/passwd查看rootcentos1 # cat /etc/passwdroot:x:0:0:root:/root:/bin/bashbin:x:1:1:bin:/bin:/sbin/nologinchongyi:x:500:500:/home/chongyi:/bin/bashcv:x:501:501:/home/cv:/bin/bash賬號(hào):密碼(x代表已經(jīng)轉(zhuǎn)移到/etc/shadow):UID:GID:用戶信息說(shuō)明:家目錄:默認(rèn)使用的shell文件系統(tǒng)的inode記錄的是UID與G

32、ID,不是賬號(hào)與組名,即一個(gè)賬號(hào)能不能讀取文件,取決于它的UID與GID.b. 不同的主機(jī),即使建立了相同的賬號(hào),但是主機(jī)分配給它們的UID與GID不一定是相同的.c. 客戶端進(jìn)入服務(wù)器端讀取文件時(shí),客戶端無(wú)論以什么賬號(hào)登陸,最后都會(huì)映射成為服務(wù)器主機(jī)上面的一個(gè)賬號(hào),如,客戶端以cv賬號(hào),UID=501登錄服務(wù)器端,如果服務(wù)器端UID=501對(duì)應(yīng)的賬號(hào)為cv01,那么客戶端的身份變?yōu)閏v01,如果UID=501在服務(wù)器端不存在,則此時(shí)服務(wù)器端將把客戶端壓縮為匿名者,分配給它的賬號(hào)為nfsnobody ,而且UID=65534.d. 客戶端進(jìn)入服務(wù)器端讀取文件的權(quán)限,取決于兩個(gè)方面,一個(gè)方面是它

33、被映射成為服務(wù)器端上賬號(hào)所能讀取的權(quán)限;另外一方面取決于服務(wù)器端/etc/exports中規(guī)定的客戶端的權(quán)限;一旦任何一方面給它限制說(shuō)不能進(jìn)行什么樣的操作,則就不能進(jìn)行那方面操作.e. 為了讓客戶端的賬號(hào)與服務(wù)器端的賬號(hào)一一對(duì)應(yīng),就必須引進(jìn)NIS服務(wù)器了.2) 設(shè)置開(kāi)機(jī)自啟動(dòng)某項(xiàng)服務(wù)通??梢杂胏hkconfig , ntsysv命令或者在/etc/rc.d/rc.local中寫入啟動(dòng)某項(xiàng)服務(wù)的命令即可:a. 用chkconfig命令啟動(dòng)某項(xiàng)服務(wù),它是有前提的,就是該服務(wù)的運(yùn)行腳本必須放在/etc/init.d/中,可以用如下命令查看chkconfig管理的服務(wù)中是否有你需要的,rootcent

34、os1 # chkconfig -list |moreabrt-ccpp 0:off 1:off 2:off 3:on 4:off 5:on 6:offabrt-oops 0:off 1:off 2:off 3:on 4:off 5:on 6:off.你也可以自己寫一個(gè)腳本,即某個(gè)服務(wù),先放入/etc/init.d/中,然后用相關(guān)的命令把它轉(zhuǎn)化為chkconfig管理開(kāi)啟關(guān)閉服務(wù)的命令為rootcentos1 # chkconfig - -level 0123456 service_name on|off再用下面命令確認(rèn)是否已經(jīng)成功rootcentos1 # chkconfig - -list

35、 | grep service_name其中,等級(jí)0,1,2,3,4,5,6是系統(tǒng)的運(yùn)行等級(jí),不同等級(jí)意味著系統(tǒng)開(kāi)機(jī)初始化時(shí)開(kāi)啟的服務(wù)是不一樣的,比如等級(jí)3對(duì)應(yīng)的是“完整的含有網(wǎng)絡(luò)功能的純文本模式”,等級(jí)5是“完整的含有網(wǎng)絡(luò)功能的X Window模式”.可以用下面的命令查看當(dāng)前你的主機(jī)運(yùn)行等級(jí)rootcentos1 # runlevelN 3實(shí)例:rootcentos1 #chkconfig -level 35 ypserv on它代表無(wú)論是系統(tǒng)運(yùn)行在等級(jí)3還是等級(jí)5,在開(kāi)機(jī)初始化過(guò)程中自動(dòng)開(kāi)啟ypserv服務(wù).b. 由于/etc/rc.d/rc.local是一個(gè)腳本,它是系統(tǒng)開(kāi)機(jī)初始化完成之

36、后,去讀取其中的命令的,因此只需要把開(kāi)啟某項(xiàng)服務(wù)的命令寫到里面去就可以了.例如,開(kāi)機(jī)后自動(dòng)關(guān)閉防火墻可以這樣子:rootcentos1 # vi /etc/rc.d/rc.local#!/bin/sh# This script will be executed *after* all the other init scripts.# You can put your own initialization stuff in here if you dont# want to do the full Sys V style init stuff.touch /var/lock/subsys/loc

37、alservice iptables stop (新加入的內(nèi)容) c. 用chkconfig命令啟動(dòng)的服務(wù)先于用/etc/rc.d/rc.local 開(kāi)啟的服務(wù) d. 有好多個(gè)服務(wù),如果有規(guī)定開(kāi)啟的順序,則,如果用chkconfig命令,那么必須在/etc/init.d/中找到這些服務(wù)的腳本,然后打開(kāi)它,找到下面那一行chkconfig: xx xx xx ,其中xx是數(shù)字修改第二組數(shù)字xx的值,就可以規(guī)定這些服務(wù)的順序了(修改之后必須用命令重新把這些服務(wù)加入chkconfig管理).如果是用/etc/rc.d/rc.local管理,由于它是一個(gè)腳本,因此放在前面的就首先開(kāi)啟啦.e. 當(dāng)有多個(gè)

38、服務(wù),要求規(guī)定開(kāi)啟順序時(shí),推薦使用/etc/rc.d/rc.local,因?yàn)橛胏hkconfig要修改各個(gè)服務(wù)的腳本,這會(huì)引起混亂(萬(wàn)一一個(gè)服務(wù)還和別的服務(wù)有先后依賴關(guān)系,則混亂了).3) 開(kāi)啟|關(guān)閉防火墻的命令有:rootcentos1 # /etc/init.d/iptables status (查看狀態(tài))rootcentos1 # /etc/init.d/iptables stop (關(guān)閉)rootcentos1 # /etc/init.d/iptables start (開(kāi)啟)或者rootcentos1 # service iptables statusrootcentos1 # se

39、rvice iptables stoprootcentos1 # service iptables start (當(dāng)設(shè)置了開(kāi)機(jī)自動(dòng)關(guān)閉后,可以用這命令重新開(kāi)啟防火墻)開(kāi)機(jī)自動(dòng)關(guān)閉可以:rootcentos1 # chkconfig -level 35 iptables off或者,在/etc/rc.d/rc.local中寫入/etc/init.d/iptables stop或者寫入service iptables stop4) 什么是命令?其實(shí)命令只是一個(gè)可執(zhí)行的腳本而已;什么是命令的參數(shù)?其實(shí)它們只是腳本的參數(shù)而已.例如,rootcentos1 # which man (對(duì)應(yīng) “腳本 腳本參

40、數(shù)$0 $1 $2 ” )/usr/bin/man (腳本輸出值)命令行的which 其實(shí)就是一個(gè)可執(zhí)行腳本,而man 是第一個(gè)參數(shù)$0 . 之所以在任何目錄下都可以用which ,因?yàn)樗褀hich這個(gè)腳本的絕對(duì)路徑加入了PATH這個(gè)全局環(huán)境變量中;所以,當(dāng)你自己寫了一個(gè)可執(zhí)行腳本,為了讓它在所有目錄下都可以執(zhí)行,只需把該腳本所在的絕對(duì)路徑加入PATH中.5)安裝NFSa. 在centos1也就是主節(jié)點(diǎn),上安裝NFS Serverrootcentos1 # yum install rpcbind (centos6.3版本中,portmap變改名為rpcbind,是RPC主程序)rootcen

41、tos1 # yum install nfs-utils (是NFS的核心,主程序) rootcentos1 # mkdir -p /cluster/server (設(shè)置/disk1的掛載點(diǎn))rootcentos1 # vi /etc/exports (設(shè)置共享內(nèi)容)/home 08(rw,async,no_root_squash)/disk1 08(rw,async,no_root_squash) 07(rw,async,no_root_squash)rootcentos1 # /etc/init.d/rpcbind start (

42、啟動(dòng)RPC)rootcentos1 # vi /etc/rc.d/rc.local (設(shè)置成開(kāi)機(jī)自啟動(dòng))#!/bin/sh# This script will be executed *after* all the other init scripts.# You can put your own initialization stuff in here if you dont# want to do the full Sys V style init stuff.touch /var/lock/subsys/local/etc/init.d/rpcbind startrootcentos1

43、# exportfs rv (掛載/etc/exports的設(shè)置)exporting 08:/disk1exporting 07:/disk1exporting 08:/homerootcentos1 # /etc/init.d/nfslock start (開(kāi)啟nfslock,并且設(shè)為開(kāi)機(jī)自啟動(dòng))Starting NFS statd: OK rootcentos1 # /etc/init.d/nfs start (啟動(dòng)NFS)Starting NFS services: OK Starting NFS quotas: OK Star

44、ting NFS mountd: OK Stopping RPC idmapd: OK Starting RPC idmapd: OK Starting NFS daemon: OK rootcentos1 # vi /etc/rc.d/rc.local (設(shè)置成開(kāi)機(jī)自啟動(dòng)).touch /var/lock/subsys/local/etc/init.d/rpcbind start/etc/init.d/nfslock stop /etc/init.d/nfslock start/etc/init.d/nfs stop (先關(guān)掉)/etc/init.d/nfs start (再開(kāi)啟)注:為什么

45、先關(guān)掉再開(kāi)啟,因?yàn)榕虏恍⌒挠胏hkconfig設(shè)了nfs,這樣nfs會(huì)先于RPC啟動(dòng),可是RPC必須先于NFS啟動(dòng),這樣NFS才可以向RPC注冊(cè).rootcentos1 cluster# mount -t nfs -o rw,bg,soft 07:/disk1 /cluster/server rootcentos1 disk1# ls al (查看/disk1的內(nèi)容)drwxr-xr-x. 2 root root 4096 Jul 30 11:10 hahadrwx-. 2 root root 16384 Jul 26 06:46 lost+foundrootcentos1

46、 disk1# cd /cluster/serverrootcentos1 server# ls al (/cluster/server中的內(nèi)容和/disk1下的一樣,掛載成功)drwxr-xr-x. 2 root root 4096 Jul 30 11:10 hahadrwx-. 2 root root 16384 Jul 26 06:46 lost+found rootcentos1 server# vi /etc/rc.d/rc.local (加入開(kāi)機(jī)自動(dòng)掛載中)./etc/init.d/nfs startmount -t nfs -o rw,bg,soft 07:/

47、disk1 /cluster/serverb. 在centos2也就是子節(jié)點(diǎn),上安裝NFS Clientrootcentos2 # yum install rpcbind (centos6.3版本中,portmap變改名為rpcbind,是RPC主程序)rootcentos2 # yum install nfs-utils (是NFS的核心,主程序) rootcentos2 # mkdir -p /cluster/server (設(shè)置/disk1的掛載點(diǎn))rootcentos2 # /etc/init.d/rpcbind startrootcentos2 # /etc/init.d/nfslo

48、ck startrootcentos2 # /etc/init.d/nfs startrootcentos2 # showmount -e 07 (檢查是否連接成功)clnt_create: RPC: Port mapper failure - Unable to receive: errno 113 (No route to host)以上說(shuō)明出錯(cuò)了,在于防火墻沒(méi)有設(shè)置,因此,在centos1和centos2上都關(guān)閉防火墻rootcentos1 # service iptables stoprootcentos2 # service iptables stoprootce

49、ntos2 # showmount -e 07 Export list for 07:/disk1 07,08/home 08rootcentos2 # mount -t nfs -o rw,bg,soft 07:/home /homerootcentos2 # mount -t nfs -o rw,bg,soft 07:/disk1 /cluster/serverrootcentos2 # cd /cluster/server (檢查是否掛載成功)roo

50、tcentos2 server# ls al (centos2中/cluster/server里面的內(nèi)容和centos1中/disk1下的內(nèi)容一樣,成功了)drwxr-xr-x. 2 root root 4096 Jul 30 11:10 hahadrwx-. 2 root root 16384 Jul 26 06:46 lost+foundrootcentos2 server# vi /etc/rc.d/rc.local (把以上內(nèi)容放入開(kāi)機(jī)自啟動(dòng)中)#!/bin/sh# This script will be executed *after* all the other init scri

51、pts.# You can put your own initialization stuff in here if you dont# want to do the full Sys V style init stuff.touch /var/lock/subsys/localservice iptables stop/etc/init.d/rpcbind start/etc/init.d/nfslock stop/etc/init.d/nfslock start/etc/init.d/nfs stop/etc/init.d/nfs start mount -t nfs -o rw,bg,soft 07:/home /homemount -t nfs -o rw,bg,soft 07:/disk1 /cluster/server并且,一定要把service iptables stop 寫入centos1中/etc/rc.d/rc.local中開(kāi)機(jī),重啟兩臺(tái)電腦,看能否創(chuàng)建文件rootcentos2 # cd /cluster/serverrootcentos2 server# ls -aldrwxr-xr-x. 2 root root 4096 Jul 30 11:

溫馨提示

  • 1. 本站所有資源如無(wú)特殊說(shuō)明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請(qǐng)下載最新的WinRAR軟件解壓。
  • 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請(qǐng)聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
  • 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁(yè)內(nèi)容里面會(huì)有圖紙預(yù)覽,若沒(méi)有圖紙預(yù)覽就沒(méi)有圖紙。
  • 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
  • 5. 人人文庫(kù)網(wǎng)僅提供信息存儲(chǔ)空間,僅對(duì)用戶上傳內(nèi)容的表現(xiàn)方式做保護(hù)處理,對(duì)用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對(duì)任何下載內(nèi)容負(fù)責(zé)。
  • 6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請(qǐng)與我們聯(lián)系,我們立即糾正。
  • 7. 本站不保證下載資源的準(zhǔn)確性、安全性和完整性, 同時(shí)也不承擔(dān)用戶因使用這些下載資源對(duì)自己和他人造成任何形式的傷害或損失。

最新文檔

評(píng)論

0/150

提交評(píng)論