1.创建层级文件kylin01和kylin02
mkdir -p /nfsdata/kylin01
mkdir -p /nfsdata/kylin02
2.该权限和所属组
sudo chown nobody:nobody /nfsdata
sudo chmod -R 777 /nfsdata
sudo chown nobody:nobody /nfsdata/kylin01
sudo chmod -R 777 /nfsdata/kylin01
sudo chown nobody:nobody /nfsdata/kylin02
sudo chmod -R 777 /nfsdata/kylin02
3.编辑NFS的/etc/expots并添加以下配置
/nfsdata/kylin01 *(ro,sync,no_subtree_check,no_root_squash)
/nfsdata/kylin02 *(rw,sync,no_subtree_check,no_root_squash)
- ro: 只读权限
- rw:读写权限
- no_subtree_check: 提高性能,不检查子目录
- no_root_squash: 允许远程root具有本地root相同权限
- sync: 挂载选项(收到客户端写入请求后,等待数据被完全写入磁盘中,再像客户端发送请求)
4.重启服务
sudo exportfs -arv
sudo systemctl restart nfs-server
sudo systemctl status nfs-server
5.客户端挂载
mkdir -p /kylin/client01
mkdir -p /kylin/client02
sudo mount -t nfs 服务器ip:/nfsdata/kylin01 /kylin/client01
sudo mount -t nfs 服务器ip:/nfsdata/kylin02 /kylin/client02
6.验证
df -h
7.firewall放行相应端口
firewalld-cmd –permanent –add-service=nfs
firewalld-cmd –permanent –add-service=mountd
firewalld-cmd –reload
评论前必须登录!
注册