部署NFS服务端与客户端并测试
NFS 服务端需要安装 rpcbind 和 nfs-utils
NFS 客户端只需要安装 nfs-utils
nfs端口号2049
RPC端口号111
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
服务端:使用yum安装#yum install -y nfs-utils rpcbind
客户端:使用yum安装#yum install -y nfs-utils
服务端创建开放目录与授权:
配置NFS存储共享⽬录并授权
mkdir -p /opt/nfs/rancher && chmod -R 777 /opt/nfs/rancher
开放nfs共享目录权限
echo "/opt/nfs/rancher 192.168.xxx.xxx(rw,sync,insecure,no_subtree_check,no_root_squash)" >> /etc/exports
加载nfs开放目录并查看
exportfs -ar && more /etc/exports
服务端启动:
启动 RPC 服务
systemctl start rpcbind
启动 NFS 服务
systemctl start nfs-server
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
客户端创建挂载点并将开放目录挂载
showmount -e 服务端地址
客户端创建挂载文件夹
mkdir -p /opt/nfs
将客户端的文件夹挂载到nfs服务端并查看挂载状态
mount 服务端IP地址:/opt/nfs/rancher /opt/nfs
之后就可以在服务端创建文件,在客户端访问进行了