服务端
安装nfs服务包:
# apt install nfs-kernel-server
准备共享目录
mkdir /mnt/sharedir
chown nobody:nogroup /mnt/sharedir
chmod 777 /mnt/sharedir
配置
编辑/etc/exports
,添加如下内容:
# NFS4需要设置fsid=0,insecure_locks,insecure
/mnt/sharedir *(rw,sync,fsid=0,insecure_locks,insecure,no_subtree_check,no_root_squash)
启动服务
exportfs -a
systemctl restart nfs-server.service
客户端
安装nfs包
一般系统都已经默认安装,若没有则安装
apt install nfs-common
查看服务器NFS共享
showmount -e 192.168.42.129
挂载
# 服务器目录只需要指定到/
$ sudo mount.nfs4 192.168.42.129:/ /mnt/nfs_mount
参考
http://bucktownbell.com/?p=4595
https://askubuntu.com/questions/35077/cannot-mount-nfs4-share-no-such-file-or-directory