Site icon 咖啡偶-IT日常

centos 7 啟用NFS server

服務器端啟用nfs server

yum install nfs-utils

## 分享目錄
mkdir -p /mnt/docker
vi etc/exports
=================
#只讀ro,  10.192.130.4可使用
/mnt/docker      10.192.130.4(ro,sync,no_root_squash,no_all_squash)
#讀寫rw,  10.192.130.0/24網段可使用
/mnt/docker      10.192.130.0/24(rw,sync,no_root_squash,no_all_squash)
=================

#啟用
firewall-cmd --zone=public --add-service=nfs --permanent

## rockylinux
#firewall-cmd --add-service={nfs,nfs3,mountd,rpc-bind} --permanent

firewall-cmd --reload
systemctl enable nfs 
systemctl start nfs

## rockylinux
#systemctl enable nfs-server rpcbind
#systemctl start nfs-server rpcbind

#查看狀態(windows,linux通用)
showmount -e localhost

用戶端(linux)

mount -t nfs <server ip>:/mnt/docker  <本地要掛載的目錄>
或是
mount -t nfs4 <server ip>:/mnt/docker  <本地要掛載的目錄>

用戶端(windows)

mount -o anon  \\ip\mount_path  z:
Exit mobile version