安装NFS服务

代码片段
1 行
yum -y install rpcbind nfs-utils

创建共享目录并且设置相应的权限

编辑配置文件

GDScript3
1 行
vim /etc/exports
代码片段
5 行
/data/share/ 192.168.0.101(rw,no_root_squash,no_all_squash,sync)
/home/data/ 192.168.0.0/24(rw,no_root_squash,no_all_squash,sync) #允许局域网内所有的客户端访问

#NFS客户端挂载nfs服务器共享目录时的报错及解决办法:mount.nfs: access denied by server while mounting
/nfsfile 192.168.41.*(rw,sync,root_squash)

更新配置

GDScript3
1 行
exportfs -r

启动服务

1)按照顺序启动

代码片段
2 行
systemctl start rpcbind
systemctl start nfs

2)加入开机启动项

代码片段
2 行
systemctl enable rpcbind
systemctl enable nfs

关闭防火墙和关闭 SELINUX

代码片段
2 行
systemctl disable firewalld 
setenforce 0

启动后查看NF服务是否正常

代码片段
1 行
rpcinfo -p

查看服务器(本机)是否可以连接

代码片段
1 行
showmount -e localhost

CentOS 7中搭建NFS文件共享存储服务
NFS客户端挂载nfs服务器共享目录时的报错及解决办法:mount.nfs: access denied by server while mounting