1.部署NFS Server端
1.1安裝nfs-kernel-server
sudo apt-get install nfs-kernel-server
1.2配置/etc/hosts.deny
vi /etc/hosts.deny
#在檔案中增加內容
###NFSDAEMONS
portmap:ALL
lockd:ALL
mountd:ALL
rquotad:ALL
statd:ALL
1.3配置/etc/hosts.allow
vi /etc/hosts.allow
#在檔案中增加內容
###NFSDAEMONS
portmap:用戶端IP
lockd:用戶端IP
rquotad:用戶端IP
mountd:用戶端IP
statd:用戶端IP
1.4重啟portmap deamon
/etc/init.d/portmap restart
1.5配置/etc/exports
若將192.168.71.205的/home目錄共用給192.168.71.46,在/etc/exports檔案中添加
/home 192.168.71.46(rw,sync,no_root_squash)
說明:
(1)rw是讀寫權限,唯讀為ro;
(2)sync資料同步寫入記憶體和硬碟,async資料會先暫存在記憶體,而不立即寫入硬碟;
(3) no_root_squash伺服器共用目錄使用者的屬性,如果使用者是root,那麼對於這個共用目錄來說就具有root的許可權
1.6重啟NFS服務
/etc/init.d/nfs-kernel-serverrestart
2.部署NFS client端
2.1安裝nfs-common
sudo apt-get install nfs-common
2.2掛載NFS
如:將192.168.71.205 NFS服務端的/home/掛載到192.168.71.46的NFS用戶端上,在192.168.71.46機器上 執行:
mount-t nfs -o tcp,soft,intr,timeo=50,retrans=12, 192.168.71.205:/home /home/testclient(這兩 個目錄必須是兩台機器上已存在的)。
2.3檢查掛載是否成功
df
2.4卸載
unmount /home/testclient
查看本欄目更多精彩內容:http://www.bianceng.cnhttp://www.bianceng.cn/OS/Linux/