> For AI agents: the complete documentation index is available at https://www.tteam.icu/zh/llms.txt, the full documentation bundle is available at https://www.tteam.icu/zh/llms-full.txt.

# nfs


AI 总结AI 生成

**核心内容**：介绍 NFS 网络文件系统的服务端安装配置和客户端挂载方法。
**内容要点**：
- 安装 NFS 服务端
- NFS 客户端连接
- 开机自动挂载 NFS
内容偏向可直接复用的运维操作，涵盖命令、配置顺序和部署注意事项。

## 安装 NFS 服务端

```bash
yum install -y nfs-utils
apt install -y nfs-kernel-server

# 这里的 * 可以替换为 IP，如 192.168.1.1/24
echo "/nfs/data/ *(insecure,rw,sync,no_root_squash)" > /etc/exports
# 执行以下命令启动 NFS 服务并创建共享目录
mkdir -p /nfs/data

systemctl enable rpcbind --now
systemctl enable nfs-server --now

# 使配置生效
exportfs -r

# 检查配置是否生效
exportfs
```

## NFS 客户端连接

```bash
# 列出该 IP 下 NFS 的共享列表
showmount -e 192.168.70.12

mkdir -p /nfs/data
# 挂载
mount -t nfs 192.168.70.12:/nfs/data /nfs/data
```

## 开机自动挂载 NFS

```bash
vi /etc/fstab

192.168.70.12:/volume1/data /nfs/data              nfs     defaults      0 0
```
