服务端 192.168.1.15
客户端 192.168.1.157

1服务端安装过程

1.下载 nfs-utils和 rpcbind
yum install -y nfs-utils rpcbind
2.启动rpcbind(必须先启动)
systemctl start rpcbind
3.启动nfs-utils
systemctl start nfs
4.查看进程

ps aux | grep nfs
ps aux | grep rpcbind

5.设置开机自启动

systemctl enable rpcbind
systemctl enable nfs

6.查看自启情况
systemctl list-unit-files --type=service|grep "enabled"|egrep "rpcbind|nfs"
7.创建目录
mkdir /data
8.给权限
chown -R nfsnobody.nfsnobody /data
9.配置共享目录

cat>>/etc/exports<<EOF
> #NFS server share directories
> /data 192.168.1.0/24(rw,sync)
> EOF

10.平滑重启nfs
systemctl reload nfs
11.查看挂载目录
showmount -e 192.168.1.158(服务端Ip)
12.关闭防火墙

systemctl stop firewalld
setenforce 0

13.给/data目录加权限
chmod 777 /data

2 客户端安装

1.下载
yum install nfs-utils rpcbind -y
2.启动rcpbind(不用启nfs)
systemctl start rpcbind
3.设置开机自启动
systemctl enable rpcbind
4.本地查看挂载目录
showmount -e 192.168.1.158
5.设置开机自动挂载

mount -t nfs 192.168.1.158:/data /mnt
echo "mount -t nfs 192.168.1.158:/data /mnt">>/etc/rc.local

6.查看
df -h
7.关闭防火墙

systemctl stop firewalld
setenforce 0