在Ubuntu系統中配置NFS

來源:互聯網
上載者:User

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/

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.