NFS服务端192.24.24.1 NFS客户端:192.24.24.6
1、安装nfs,rpcbind
yum -y install nfs-utils rpcbind
2、添加配置/etc/exports文件
vi /etc/exports
输入如下内容:
然后输入/home/cams/file 192.24.24.6 (rw,sync,no_root_squash,no_all_squash)
3、启动rpcbind服务
systemctl start rpcbind
4、启动nfs服务(启动先启动rpcbind,停止先停止NFS)
systemctl start nfs
5、查看共享状态(如果提示RPC:program not registered。重启nfs:systemctl stop nfs,systemctl stop rpcbind,systemctl start rpcbind,systemctl start nfs)
showmount -e
6、在NFS客户端查询NFS的共享状态
showmount -e 192.24.24.1
可能报错(clnt_create: RPC: Port mapper failure - Unable to receive: errno 113 (No route to host)
),检查服务器端防火墙是否开启。
7、客户端挂载服务端共享目录(开发服务端端口2049 :
firewall-cmd --zone=public --add-port=2049/tcp --permanent
firewall-cmd --reload
)
mount -t nfs 192.24.24.1:/pub /pub