ubuntu 26部署nfs服务

环境:
Os:ubuntu 26

#############################服务端安装######################
1.安装nfs服务包
apt update
apt install -y nfs-kernel-server

 

2.创建共享目录,设置权限
mkdir -p /nfs/seatunnel
# NFS 匿名用户默认是 nobody:nogroup
chown nobody:nogroup /nfs/seatunnel
chmod 770 /nfs/seatunnel

 

3.编辑导出配置/etc/exports
vi /etc/exports
# 格式:共享目录 客户端(选项)
# 允许 192.168.1.0/24 整个网段访问,rw读写,sync同步,no_subtree_check
/nfs/seatunnel 192.168.1.0/24(rw,sync,no_subtree_check,no_root_squash)

 

4.生效配置 + 启动自启
# 重新加载exports配置,不用重启服务
root@dify:/# exportfs -arv
exporting 192.168.1.0/24:/nfs/seatunnel

# 开机自启 + 启动
systemctl enable --now nfs-kernel-server
systemctl status nfs-kernel-server

 

#######################客户端###############################
客户端是centos 7的环境
1.安装客户端依赖
yum install -y nfs-utils

 

2.创建本地挂载点
mkdir -p /nfs/seatunnel

 

3.测试查看 NFS 共享(可选)
showmount -e 192.168.12.87

 

4.挂载
mount -t nfs 192.168.12.87:/nfs/seatunnel /nfs/seatunnel

 

5.验证读写
touch /nfs/seatunnel/test_centos7.txt
ls /nfs/seatunnel

posted @ 2026-11-10 09:30  slnngk  阅读(3)  评论(0)    收藏  举报