Linux平台部署NFS服务

安装NFS软件包

Debian/Ubuntu

apt update
apt install nfs-kernel-server

CentOS/RHEL
yum install nfs-utils

配置导出规则(授权访问)
编辑/etc/exports

添加内容

# 共享目录         允许访问的客户端            权限选项
/mnt/sdb          192.168.1.100(rw,sync,no_subtree_check,root_squash)

选项说明:
rw:读写权限
sync:同步写入
no_subtree_check:提升性能
root_squash:将root用户映射为匿名用户(安全)

应用配置
exportfs -arv

启动服务

systemctl start nfs-server   # CentOS/RHEL
systemctl start nfs-kernel-server  # Debian/Ubuntu

设置开机自启

systemctl enable nfs-server
systemctl enable nfs-kernel-server