服务端:

1.关闭防火墙: systemctl stop firewalld

2.selinux设置许可模式: setenforece 0

3.查看是否安装nfs: rpm -qi nfs

yum install nfs

4.创建共享目录: chmod /data/packet

5.修改nfs配置: vim /etc/exports

添加需要共享的目录: /data/packet *(rw,sync)

/data/packet 代表共享文件夹

* 代表所有主机都可访问

参数含义:rw 为读写权限,ro 为只读;sync 为使用同步方式;insecure 为不需要密码访问

6.启动nfs服务: systemctl start nfs


客户端:

1.关闭防火墙

2.安装nfs

3.将服务端的共享目录挂载到本机目录下

mount.nfs 服务器地址:/服务器共享的目录 挂载到客户端的目录


note:

1.mount.nfs:Operation not permitted

解决方法:在 /etc/exports 中添加 insecure 参数跳过授权访问