一、服务端环境搭建
1、nfs-utils:NFS服务主程序;
yum install -y nfs-utils
2、rpcbind服务;
yum install -y rpcbind
3、启动顺序:先开启rpcbind,再开启nfs服务;
systemctl start rpcbind.service
systemctl start nfs-server.service
4、设置开机自启动;
systemctl enable rpcbind.service 或者:
( ln -s /usr/lib/systemd/system/rpcbind.service /etc/systemd/system/multi-user.target.wants/rpcbind.service) systemctl enable nfs-server.service
5、关闭防火墙并关闭开启自启动;
systemctl stop firewalld systemctl disable firewalld
6、编辑/etc/exports,并平滑重启nfs服务; /data 192.168.1.0/24(rw,sync) systemctl reload nfs-server.service
7、设置共享目录属主、权限;
chmod 777 /data chown -R nfsnobody.nfsnobody /data
二、客户端环境搭建;
1、rpcbind服务;
yum install -y rpcbind
2、开启rpcbind服务,并设置开机自启动;
systemctl start rpcbind.service systemctl enable rpcbind.service
3、关闭防火墙并关闭开机自启动;
systemctl stop firewalld systemctl disable firewalld
4、查看nfs共享,并挂载; showmount -e nfs服务器IP:共享目录 mount -t nfs nfs服务器IP:/data /mnt