NFS安裝與配置
阿新 • • 發佈:2017-12-20
linux nfs 服務器端
yum install -y nfs-utils rpcbind (安裝nfs以及rpcbind[通信協議])
vim /etc/exports (編輯配置文件,如下)
/mnt 192.168.111.128(rw,sync) #分享那個文件夾,到哪個IP地址,以及讀寫權限和傳輸協議
/mnt 192.168.111.128(rw,sync,all_squash,anonuid=501,anongid=501) #將用戶權限限制為501用戶,/etc/passwd下必須有這個用戶
/mnt 192.168.111.128(rw,sync,no_root_squash) #不限制root,不安全!
/etc/init.d/rpcbind start (開啟rpcbind服務)
/etc/init.d/nfs start (開啟nfs服務)
exportfs -arv (重啟nfs服務)
客戶端
yum install -y nfs-utils (安裝nfs服務)
showmount -e 192.168.111.129 (查看指定IP有哪些共享的文件夾)
mount -t nfs 192.168.111.129:/mnt /opt (把客戶端的文件夾掛載到本地的opt文件夾下)
mount -t nfs -onolook,nfsvers=3 192.168.111.129:/mnt /opt (nfs不鎖定,且版本指定為3)
df -h (查看掛載情況)
cd /opt (移動到opt文件夾下,可對共享文件夾內容進行操作)
NFS安裝與配置