1.server端和服务器端都需要安装 nfs-utils rpcbind 包。也可以安装NFS file server包组。
2.server端安装完成后编辑/etc/exports
/home/nfs 10.33.133.249(rw,sync,no_root_squash,all_squash,anonuid=99,anongid=65534)
#/home/nfs server端要共享的目录
#10.33.133.249 哪些客户机可以访问此server端。
#10.33.133.0/24 可以使用网段授权
#*.com 使用主机名授权。
rw:读写权限。
ro:只读权限
sync:同步数据写入磁盘。
no_root_squash:当客户端使用root访问目录时,此客户端对此目录页具有root权限。
all_squash:将所有挂载此目录的客户端所具有的权限都为后面指定的anonuid=99,anongid=65534
showmount -e 10.33.133.244 查看服务器端可挂载目录列表。
客户端挂载:
mount -t nfs 10.33.133.244:/home/nfs/ /data/
// 将服务器端挂载到本地data目录。
当服务端服务异常时,经常无法正常卸载已挂载的目录。
使用umonut -lf /dirname 可以强制卸载。