NFS ubuntu安装及配置

1、安装 apt-get install nfs-kernel-server
2、配置参数 vim /etc/exports

3、生效 service nfs-kernel-server reload
4、重启服务 service nfs-kernel-server restart

5、配置内容
共享目录 地址段(权限)
/public *(rw,sync,no_subtree_check,no_root_squash)
/ulapp/public 172.109.0.0/16(rw,sync,no_root_squash,no_subtree_check)
/ulapp/public1 172.109.10.0/24(rw,sync,no_root_squash,no_subtree_check)

#   ro 只读访问
#   rw 读写访问sync 所有数据在请求时写入共享
#   async nfs在写入数据前可以响应请求
#   secure nfs通过1024以下的安全TCP/IP端口发送
#   insecure nfs通过1024以上的端口发送
#   wdelay 如果多个用户要写入nfs目录,则归组写入(默认)
#   no_wdelay 如果多个用户要写入nfs目录,则立即写入,当使用async时,无需此设置。
#   hide 在nfs共享目录中不共享其子目录
#   no_hide 共享nfs目录的子目录
#   subtree_check 如果共享/usr/bin之类的子目录时,强制nfs检查父目录的权限(默认)
#   no_subtree_check 和上面相对,不检查父目录权限
#   all_squash 共享文件的UID和GID映射匿名用户anonymous,适合公用目录。
#   no_all_squash 保留共享文件的UID和GID(默认)
#   root_squash root用户的所有请求映射成如anonymous用户一样的权限(默认)
#   no_root_squash root用户具有根目录的完全管理访问权限
#   anonuid=xxx 指定nfs服务器/etc/passwd文件中匿名用户的UID


6、客户端挂载
查看服务端共享目录 showmount -e <ip address of nfs server> #例如showmount -e 10.33.xx.xx

7、创建挂载点
mkdir /public-mount
chmod 777 -R /public-mount
mount -t nfs 10.33.xx.xx:/public /public-mount

8、挂载点开机自启
将mount -t nfs 10.33.xx.xx:/public /public-mount 添加到/etc/rc.local
 
 
 
 
posted @ 2021-04-07 14:41  楚伟  阅读(283)  评论(0)    收藏  举报