NFS服務端的主要配置檔案是/etc/exports,預設不存在需要手動建立。
工具/原料
NFS
centos
方法/步驟
nfs依賴於RPC服務,所以在安裝nfs前必須先安裝RPC服務,安裝命令如下
yum install rpcbind
再安裝nfs服務
yum install nfs-utils
建立共享目錄
mkdir /nfsfiles
建立測試檔案
echo “this is my first nfs server” > /nfsfiles/README
vim /etc/exports
/nfsfiles 192.168.150.*(rw,sync,root_squash)
啟動服務
客戶端進行掛載
將共享檔案掛載到已經建立好了的資料夾/nfsfiles中
mount -t nfs 192.168.150.181:/nfsfiles/ /nfsfiles/
進行驗證,出現以下結果表示掛載成功
注意事項
必須關閉防火牆