配置NFS服务
服务端 ip :192.168.1.10
客户端 ip :192.168.1.227
(服务端与客户端均须关闭防火墙、降低沙盒)
服务端配置
用 yum 安装 nfs 以及rpcbind
[root@bogon ~]# yum -y install nfs-utils rpcbind
编辑配置文件客户端访问,内容如下图
[root@bogon ~]# vim /etc/exports
创建目录 /home/xyl ,并赋予其权限
[root@bogon ~]# mkdir /home/xyl
[root@bogon ~]# chmod 777 /home/xyl/
按如下顺序开启服务
[root@bogon ~]# systemctl start rpcbind
关闭防火墙
[root@bogon ~]# systemctl start nfs
[root@bogon ~]# systemctl stop firewalld
降低沙盒
[root@bogon ~]# getenforce
Enforcing
[root@bogon ~]# setenforce 0
[root@bogon ~]# getenforce
Permissive
查看是否能 ping 通客户端
[root@bogon ~]# ping 192.168.1.227
客户端配置
用 yum 安装 nfs以及rpcbind
[root@localhost ~]# yum -y install nfs-utils rpcbind
按如下顺序开启服务
[root@localhost ~]# systemctl start rpcbind
[root@localhost ~]# systemctl start nfs
检查是否能 ping 通服务端
[root@localhost ~]# ping 192.168.1.10
连接服务端
[root@localhost ~]# showmount -e 192.168.1.10
关闭防火墙
[root@localhost ~]# systemctl stop firewalld
降低沙盒
[root@localhost ~]# getenforce
Enforcing
[root@localhost ~]# setenforce 0
[root@localhost ~]# getenforce
Permissive
将服务端 /home/xyl 挂载到客户端 /mnt
[root@localhost ~]# mount -t nfs 192.168.1.10:/home/xyl /mnt
查看挂载情况
[root@localhost ~]# df -h
来源:CSDN
作者:xiaobai_xu
链接:https://blog.csdn.net/xiaobai_xu/article/details/103715613