1. 程式人生 > >Ubuntu 14.04配置nfs服務

Ubuntu 14.04配置nfs服務

網上許多nfs的配置說明所使用ubuntu版本過老或者存在其他問題

本文使用ubuntu14.04 預設安裝了rpcbing

1. 下載nfs套件
apt-get install nfs-kernel-server nfs-clinet nfs-common


2. 開啟相關服務(ubuntu)
service portmap start


3. nfs服務端配置
vi /etc/exports
<共享檔名>  <hostname1/IP1(引數)> <hostname2/IP2(引數)> ...
eg: /home/user/shared *(rw,sync,no_root_squash)
    向所有網段共享/home/user/shared檔案或資料夾,引數:讀寫、同步、非root許可權


詳細配置內容見該blog
http://blog.chinaunix.net/uid-20628575-id-72545.html


4. 開啟nfs server服務
service nfs-kernel-server start


5. 客戶端檢視共享檔案
showmount -e 192.168.1.100
(假設服務端IP為:192.168.1.100)
顯示:Export list for 192.168.1.100:
/home/user/shared *


6. 客戶端掛載共享檔案
mount -t nfs 192.168.1.100:/home/user/shared /home/user/new_folder


完成檔案共享!


FAQ:
配置過程中可能出現以下問題
1. 開啟portmap過程中出現unrecognized service portmap ....
portmap軟體不存在,可能在ubuntu高版本中替換為rpcbind,無需開啟該服務
2. 客戶端showmount看不到共享檔案
確認雙方處於同一區域網下
3. 客戶端掛載共享檔案時出現mount.nfs: access denied by server while mounting 192.168.1.108:/home/user/shared
可能原因1: 服務端允許訪問網段設定錯誤
可能原因2: 服務端引數設定為root_squash(root許可權訪問)
可能原因3: 共享檔名存在大寫,nfs服務對大小寫不敏感無法識別