1. 安装
# 服务端
apt install nfs-kernel-server rpcbind
# 客户端
apt install nfs-common
2. 创建共享目录
mkdir /data/nfs
3. 增加权限
chmod 777 /data/nfs
4. 配置共享目录
vim /etc/exports
加入 /data/nfs *(rw,sync,no_root_squash,no_subtree_check)
5. 启动服务
/etc/init.d/rpcbind restart
/etc/init.d/nfs-kernel-server restart
6. 测试
showmount -e localhost 或 showmount -e [ip]
7. 查看 NFS 服务项 rpc 服务器注册的端口列表
rpcinfo -p
8. 开始挂载
mount -t nfs 10.0.0.33:/data/nfs /data/nfs
将目标 IP 上的目录挂载到本地目录 注意:两边的 nfs 端口的开放,和防火墙的允许
9. 取消挂载
umount /data/nfs
参考:
https://blog.csdn.net/aixiaoyang168/article/details/83782336
https://www.cnblogs.com/luckcs/articles/7718196.html