CentOS下NFS服務(wù)器配置實(shí)例.doc_第1頁
CentOS下NFS服務(wù)器配置實(shí)例.doc_第2頁
CentOS下NFS服務(wù)器配置實(shí)例.doc_第3頁
CentOS下NFS服務(wù)器配置實(shí)例.doc_第4頁
CentOS下NFS服務(wù)器配置實(shí)例.doc_第5頁
已閱讀5頁,還剩3頁未讀, 繼續(xù)免費(fèi)閱讀

下載本文檔

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

文檔簡介

CentOS下NFS服務(wù)器配置實(shí)例 2011-02-23 16:54:41標(biāo)簽:CentOS NFS 服務(wù)器 原創(chuàng)作品,允許轉(zhuǎn)載,轉(zhuǎn)載時請務(wù)必以超鏈接形式標(biāo)明文章 原始出處 、作者信息和本聲明。否則將追究法律責(zé)任。/318402/498952 一,應(yīng)用環(huán)境介紹:用途操作系統(tǒng)IP地址服務(wù)器端CentOS 5.2 X86_6421客戶端CentOS 5.2 X86_6422二,NFS相關(guān)軟件的安裝:rootyouxia122 # yum -y install portmap nfs*三,服務(wù)器端配置:1,創(chuàng)建共享的目錄:rootyouxia121 data# mkidr /usr/local/data/2,修改NFS配置文件:rootyouxia121 data# vi /etc/exports/usr/local/data/ 22(rw,no_root_squash,no_all_squash,sync)注:配置文件說明:/usr/local/data/ 為共享的目錄,使用絕對路徑。22(rw,no_root_squash,no_all_squash,sync) 為客戶端的地址及權(quán)限,地址可以是一個網(wǎng)段,一個IP地址或者是一個域名,域名支持通配符,如:*.,地址與權(quán)限中間沒有空格,權(quán)限說明:rw:read-write,可讀寫;ro:read-only,只讀;sync:文件同時寫入硬盤和內(nèi)存;async:文件暫存于內(nèi)存,而不是直接寫入內(nèi)存;no_root_squash:NFS客戶端連接服務(wù)端時如果使用的是root的話,那么對服務(wù)端分享的目錄來說,也擁有root權(quán)限。顯然開啟這項(xiàng)是不安全的。root_squash:NFS客戶端連接服務(wù)端時如果使用的是root的話,那么對服務(wù)端分享的目錄來說,擁有匿名用戶權(quán)限,通常他將使用nobody或nfsnobody身份;all_squash:不論NFS客戶端連接服務(wù)端時使用什么用戶,對服務(wù)端分享的目錄來說都是擁有匿名用戶權(quán)限;anonuid:匿名用戶的UID值,通常是nobody或nfsnobody,可以在此處自行設(shè)定;anongid:匿名用戶的GID值。四,啟動NFS服務(wù)器并進(jìn)行測試:1,啟動NFS服務(wù)器:rootyouxia121 data# service portmap start啟動 portmap:確定rootyouxia121 data# service nfs start啟動 NFS 服務(wù): 確定關(guān)掉 NFS 配額:確定啟動 NFS 守護(hù)進(jìn)程:確定啟動 NFS mountd:確定2,在客戶端進(jìn)行測試:創(chuàng)建需要掛載的目錄:rootyouxia122 local# mkdir /usr/local/data/執(zhí)行掛載命令:rootyouxia122 local# mount -t nfs 21:/usr/local/data /usr/local/data -o proto=tcp -o nolock在客戶端創(chuàng)建一個測試文件并進(jìn)行檢查:rootyouxia122 # cd /usr/local/data/rootyouxia122 data# echo this is a test /usr/local/data/heheherootyouxia122 data# ll -h總計(jì) 8.0K-rw-r-r- 1 root root 15 02-23 16:47 hehehe在服務(wù)器端檢查:rootyouxia121 usr# ll -h /usr/local/data/總計(jì) 8.0K-rw-r-r- 1 root root 15 02-23 16:47 heheh五,我在配置中遇到的問題:1,在啟動NFS服務(wù)器的時候遇到的一個問題如下,原因在于NFS配置文件中地址與權(quán)限中間多了一個空格,去掉空格重新啟動即可:rootyouxia121 local# service nfs restart關(guān)閉 NFS mountd:確定關(guān)閉 NFS 守護(hù)進(jìn)程:確定關(guān)閉 NFS 服務(wù): 確定啟動 NFS 服務(wù): exportfs: No options for /usr/local/data/ 22: suggest 22(sync) to avoid warningexportfs: No host name given with /usr/local/data (rw,no_root_squash,no_all_squash,sync), suggest *(rw,no_root_squash,no_all_squash,sync) to avoid warning確定關(guān)掉 NFS 配額:確定啟動 NFS 守護(hù)進(jìn)程:確定啟動 NFS mountd:確定2,客戶端在掛載的時候遇到的一個問題如下,可能是網(wǎng)絡(luò)不太穩(wěn)定,NFS默認(rèn)是用UDP協(xié)議,換成TCP協(xié)議即可:rootyouxia122 local# mount -t nfs 21:/usr/local/data /usr/local/datamount.nfs: Input/output error解決方法:mount -t nfs 21:/usr/local/data /usr/local/data -o proto=tcp -o nolockNFS的安裝配置:centos 5 :yum install nfs-utils portmapcentos 6 :yum install nfs-utils rpcbind本節(jié)是使用centos 6的配置過程:設(shè)備:兩臺 centos6 OS 安裝的時候選擇的是Basic Server軟件配置包。首先,讓兩臺機(jī)器都安裝NFS的 軟件包,如下顯示的是服務(wù)器端:rootroothomes /home$ yum install nfs-utils rpcbindLoaded plugins: fastestmirrorLoading mirror speeds from cached hostfile* base: * extras: * updates: Setting up Install ProcessPackage rpcbind-0.2.0-8.el6.x86_64 already installed and latest versionResolving Dependencies- Running transaction check- Package nfs-utils.x86_64 1:1.2.3-15.el6 set to be updated- Finished Dependency ResolutionDependencies Resolved=Package Arch Version Repository Size=Updating:nfs-utils x86_64 1:1.2.3-15.el6 base 308 kTransaction Summary=Install 0 Package(s)Upgrade 1 Package(s)Total download size: 308 kIs this ok y/N: yDownloading Packages:nfs-utils-1.2.3-15.el6.x86_64.rpm | 308 kB 00:10warning: rpmts_HdrFromFdno: Header V3 RSA/SHA1 Signature, key ID c105b9de: NOKEYbase/gpgkey | 3.3 kB 00:00 .Importing GPG key 0xC105B9DE CentOS-6 Key (CentOS 6 Official Signing Key) from /etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6Is this ok y/N: yRunning rpm_check_debugRunning Transaction TestTransaction Test SucceededRunning Transaction Updating : 1:nfs-utils-1.2.3-15.el6.x86_64 1/2 Cleanup : 1:nfs-utils-1.2.2-7.el6.x86_64 2/2Updated: nfs-utils.x86_64 1:1.2.3-15.el6Complete!rootroothomes /home$服務(wù)器端:#(建立掛載的目錄,并且掛載目錄。)rootroothomes /etc$ mkdir /opt/centos6rootroothomes /etc$ cd /opt/centos6/rootroothomes /opt/centos6$ mkdir thisISnfsFilerootroothomes /opt/centos6$ lsthisISnfsFilerootroothomes /etc$ vi /etc/exportsrootroothomes /opt/centos6$ cat /etc/exports/opt/centos6 /24(ro,no_root_squash)# 備注:/opt/centos6表示nfs共享的目錄 -54區(qū)間的IP可以訪問,訪問權(quán)限是自讀,root 用戶#(啟動對應(yīng)的服務(wù))rootroothomes /opt/centos6$ chkconfig nfs onrootroothomes /opt/centos6$ /etc/init.d/rpcbind startrootroothomes /opt/centos6$ /etc/init.d/nfs startStarting NFS services: OK Starting NFS quotas: OK Starting NFS daemon: OK Starting NFS mountd: OK rootroothomes /opt/centos6$ service iptables stopiptables: Flushing firewall rules: OK iptables: Setting chains to policy ACCEPT: filter OK iptables: Unloading modules:三 OK 客戶端:rootroothomes /home$ yum install nfs-utils rpcbind安裝完畢!rootvmBS00 # service iptables stopiptables: Flushing firewall rules: OK iptables: Setting chains to policy ACCEPT: filter OK iptables: Unloading modules: OK #查看是否能訪問nfs服務(wù)rootvmBS00 # showmount -e 5Export list for 5:/opt/centos6 /24rootvmBS00 # mkdir /opt/centos6rootvmBS00 # mount -t nfs 5:/opt/centos6/ /opt/centos6/rootvmBS00 # ls /opt/centos6/thisISnfsFile#配置開機(jī)自動掛載rootvmBS00 # vi /etc/fstab#

溫馨提示

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

最新文檔

評論

0/150

提交評論