ubuntu安装NFS-Server提供NFS服务

2019/12/26 posted in  Linux

如果没有现成的NFS服务,可以利用现有服务器部署一套

安装NFS服务端

    sudo apt-get install nfs-kernel-server

编辑/etc/exports文件,增加你要提供nfs服务的路径

# /etc/exports: the access control list for filesystems which may be exported
#       to NFS clients.  See exports(5).
#
# Example for NFSv2 and NFSv3:
# /srv/homes       hostname1(rw,sync,no_subtree_check) hostname2(ro,sync,no_subtree_check)
#
# Example for NFSv4:
# /srv/nfs4        gss/krb5i(rw,sync,fsid=0,crossmnt,no_subtree_check)
# /srv/nfs4/homes  gss/krb5i(rw,sync,no_subtree_check)
#

/data/charts *(rw,sync,no_subtree_check,no_root_squash)
/data/mysql *(rw,sync,no_subtree_check,no_root_squash)
/data/redis *(rw,sync,no_subtree_check,no_root_squash)

更改共享目录权限,修改为777 (目前还不清楚最低要求权限是多少)

sudo chown 777  /data/charts

重启NFS服务

sudo /etc/init.d/nfs-kernel-server restart