环境:
服务端:192.168.1.101
客户端:192.168.1.102

目标:
将服务端 /root/server 目录挂载到 客户端的 /root/client

服务端

安装 nfs

yum -y install nfs-utils

启动 rpc 和 nfs

systemctl start rpcbind
systemctl start nfs

设置开机启动

systemctl enable nfs.service
systemctl enable rpcbind.service

创建共享目录

mkdir /root/server

修改共享目录权限

chmod -R 777 /root/server

配置服务端共享文件

echo "/root/server 192.168.1.102(rw)" >> /etc/exports

重载配置

exportfs -a

客户端

安装 nfs

yum -y install nfs-utils

创建共享目录

mkdir /root/client

挂载目录

mount -t nfs 192.168.1.101:/root/server /root/client

开机自动挂载

echo "192.168.1.101:/root/server /root/client nfs rw,tcp,intr 0 1" >> /etc/fstab
×