歡迎來到Linux教程網
Linux教程網
Linux教程網
Linux教程網
Linux教程網 >> Linux基礎 >> 關於Linux >> 在Ubuntu系統中配置NFS

在Ubuntu系統中配置NFS

日期:2017/3/3 16:16:28   编辑:關於Linux

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

 

Copyright © Linux教程網 All Rights Reserved