- 开放/nfs/shared目录,供所有用户查询资料;
服务器:
关闭防火墙和selinux:
[root@server ~]# systemctl stop firewalld
[root@server ~]# setenforce 0
[root@server ~]# getenforce
Permissive
创建要共享的目录文件
[root@server ~]# mkdir /nfs/shared -p
安装NFS
[root@server ~]# yum install rpcbind
[root@server ~]# yum install nfs-utils
编辑配置文件和共享目录:
[root@server ~]# vim /etc/exports
[root@server ~]# cat /etc/exports
启动服务:
[root@server ~]# systemctl status rpcbind
[root@server ~]# systemctl restart rpcbind
[root@server ~]# systemctl restart nfs-server
[root@server ~]# showmount -e 192.168.189.143
客户端:
关闭防火墙和selinux:
[root@client ~]# systemctl stop firewalld
[root@client ~]# setenforce 0
[root@client ~]# getenforce
Permissive
安装NFS
[root@server ~]# yum install rpcbind
[root@server ~]# yum install nfs-utils
查看共享目录
[root@client ~]# showmount -e 192.168.189.143
挂载服务端的共享文件到/wang
[root@client ~]# mount -t nfs 192.168.189.143:/nfs/shared /wang