yum install -y nfs-utils rpcbind
#先安装nfs文件系统,在通过rpc传输
cat ```/etc/exports ```
/tmp 192.168.100.0/24(rw,)
/data/NFS 10.0.0.0/8(ro,sync,no_root_squash)
#设置nfs路径文件
/opt/software 10.0.2.0/24(rw,sync,no_root_squash,insecure)
#mac 添加insecure
yum install -y nfs-utils # 安装组件
rpcinfo 192.168.100.1
#检查rpc传输
showmount -e 192.168.100.1
#查看nfs服务的文件路径
mount -t nfs 192.168.100.1:/data/NFS /data
#挂载
umount /data
#卸载本地挂载点
systemctl restart rpcbind
systemctl restart nfs
配置选项说明: ro #read only rw #read write no_root_squash #信任客户端,对应 UID noaccess #客户端不能使用 sync #同步 async #异步方式
vi /etc/sysconfig/nfs
#修改nfs默认端口
ping -c 1 -q ntfs.com &>/dev/null && mount /home/wij &>/dev/null
# 判断在挂载