YUM安装
yum install nfs nfs-utils -y
vim /etc/exports
/www/html *(rw,no_root_squash,no_all_squash,sync)
/www/html1 *(rw,no_root_squash,no_all_squash,sync) 可以多个目录
/data/ 10.10.10.0/24(rw,sync) 可以限定IP
配置详情
rw 可读写
no_root_squash root有完全读写权限
no_all_squash 保留UID,GID
sync 同步刷新
systemctl restart nfs
挂载NFS
别的机器上, -t是类型,NFS类型
mount -t nfs 192.168.10.102:/www/html /www/html
别的机器上取消挂载
umount /www/html
df -h 查看
设置开机启动
vim /etc/fstab
在最后一排插入
10.10.10.10:/usr/local/nginx/html /data/nfs nfs defaults 0 0
# 第一个是备份 第二个是扫描 一般都是0 0