centos8配置nfs教程本机系统mac

1 在服务器端 安装nfs 以及 rpcbind

yum install -y nfs-utils  rpcbind
mkdir -p /data/nfs
chown -R nfsnobody:nfsnobody /data/nfs

2 配置权限

 vim /etc/exports

文件写入

#nfs dir /data/nfs

/data/nfs192.168.1.0/24(rw) #客户端ip(rw,sync,insecure) #不加insecure会connect refuse

nfs 服务命令配置参数

ro 只读

rw 读写

root_squash 当NFS客户端以root管理员访问时,映射为NFS服务器的匿名用户

no_root_squash 当NFS客户端以root管理员访问时,映射为NFS服务器的root管理员

all_squash 无论NFS客户端使用什么账户访问,均映射为NFS服务器的匿名用户

sync 同时将数据写入到内存与硬盘中,保证不丢失数据

async 优先将数据保存到内存,然后再写入硬盘;这样效率更高,但可能会丢失数据

启动配置

service rpcbind start #启动服务
systemctl enable rpcbind #设置开机启动

查询nfs挂载,showmount -e 192.168.1.24 后面可以接ip来查看

3 客户端连接

mount -t nfs 192.168.85.131:/data/nfs/sunshine /Users/apple/Documents/share-nfs/ #挂载nfs server的/data/nfs 到/nfs