不说没用的开场白!直接干货,上!
yum install nfs-utils rpcbind -y
#客户端、服务端都安装并添加开机启动
mkdir -p /nfs_test
#创建本地存储目录
vim /etc/exports
#默认为空 *为everyone
/nfs_test 10.0.2.15(rw,no_root_squash,no_all_squash,async)
/nfs_test *(rw,no_root_squash,no_all_squash,async)
no_root_squash
#root用户具有完全的管理权限;
async
#数据先暂时在内存中不直接写入磁盘
sync
#表示数据直接同步到磁盘;
systemctl enable rpcbind
systemctl enable nfs
systemctl start rpcbind systemctl start nfs
systemctl status rpcbind systemctl status nfs
exportfs -a
#刷新配置即可生效,无需重启
mkdir /mnt/test
#客户端创建挂载目录
mount -t nfs 10.0.2.17:/nfs_test /mnt/test
#挂载nfs
umount /mnt/test
#卸载命令
vim /etc/fstab
10.0.2.17:/nfs_test /mnt/test nfs rw,tcp,intr 0 1
#添加开机自动挂载
#在客户端创建一个文件测试是否可用、服务端是否同步
服务端
成功!!!