部署nfs服務
阿新 • • 發佈:2021-11-22
nfs(Network File System),通過網路,讓不同的機器、不同的作業系統可以共享彼此的檔案。
Server端
安裝
sudo yum -y install nfs-utils
如果要監聽在固定埠
sudo vi /etc/sysconfig/nfs
加入內容
LOCKD_TCPPORT=30001 #TCP鎖使用埠
LOCKD_UDPPORT=30002 #UDP鎖使用埠
MOUNTD_PORT=30003 #掛載使用埠
STATD_PORT=30004 #狀態使用埠
啟動/重啟服務
sudo systemctl restart rpcbind.service sudo systemctl restart nfs-server.service
設定開機啟動
sudo systemctl enable rpcbind.service
sudo systemctl enable nfs-server.service
編輯共享目錄
sudo vi /etc/exports
共享/home/txl/test資料夾,允許172.23.73內網地址掛載
/home/txl/test 172.23.73.0/24(rw,async)
然後重啟服務
sudo systemctl restart nfs-server.service
檢視掛載
showmount -e localhost
Client端
安裝
sudo yum -y install nfs-utils
檢視Server端共享的目標資料夾
showmount -e 172.23.73.187
掛載
mount -t nfs 172.23.73.187:/home/txl/test /home/txl/test
檢視掛載
df -h
解除安裝
umount /home/txl/test