1、选取192.168.65.10作为主服务器,192.168.65.11作为从服务器
2、主机安装rpcbind、nfs服务
yum install nfs-utils rpcbind
3、主机编写配置文件
vim /etc/exports
/data/nginx 192.168.65.0/24(rw,sync,fsid=0)
#同192.168.65.0/24一个网络号的主机可以挂载NFS服务器上的/home/nfs/目录到自己的文件系统中,rw表示可读写;sync表示同步写,fsid=0表示将/data找个目录包装成根目录
4、先为rpcbind和nfs做开机启动:(必须先启动rpcbind服务)
systemctl start rpcbind.service
systemctl start nfs-server.service
systemctl enable rpcbind.service//开机启动
systemctl enable nfs-server.service//开机启动
5、rpcinfo -p #检查 NFS 服务器是否挂载我们想共享的目录
6、exportfs -r #使配置生效
7、exportfs#查看共享目录
8、丛机安装主机安装nfs
9、启动rpcbind
systemctl start rpcbind.service#不需要启动nfs
10、showmount -e 192.168.65.10 #检查 NFS 服务器端是否有目录共享:showmount -e nfs服务器的IP
11、mount -t nfs 192.168.65.10:/data/nginx /data/nginx#挂载目录到共享服务器
12、df -h #查看是否挂载成功