共两台服务器:
192.168.150.206(主)
192.168.150.207(客户端)
服务器主:
第一步:先关闭防火墙
systemctl stop firewalld
setenforce 0
第二步:安装nfs和rpcbind
yum -y install nfs-utils rpcbind
第三步:创建共享的文件
mkdir -p /data/web
授权:
chmod -R 777 /data/web/
启动:
(先启动rpcbind)
systemctl start rpcbind
systemctl start nfs
修改配置文件:
vim /etc/exports
/data/web 192.168.150.0/24(rw,sync)
再重启一下rpcbind和nfs
systemctl restart rpcbind
systemctl restart nfs
查看一下自己共享服务:
[root@localhost ~]# showmount -e
Export list for localhost.localdomain:
/data/web 192.168.150.0/24
服务器客户端:
和主一样,先安装
yum -y install nfs-utils rpcbind
启动:
systemctl start rpcbind
systemctl start nfs
显示NFS服务器共享目录列表:
[root@localhost ~]# showmount -e 192.168.150.206
Export list for 192.168.150.206:
/data/web 192.168.150.0/24
挂载服务端的共享目录:
mount -t nfs 192.168.150.206:/data/web /mnt