apt-get -y install nfs-kernel-server
mkdir /nfsdata
vim /etc/exports 添加: /nfsdata IP地址(rw,sync,no_root_squash,no_subtree_check)
nfsdata:须要被同步的目录 IP地址:须要同步数据的IP地址 rw:挂接此目录的客户端对该共享目录具备读写权限 sync:资料同步写入内存和硬盘 no_root_squash:root用户具备对根目录的彻底管理访问权限。 no_subtree_check:不检查父目录的权限。
systemctl restart nfs-kernel-server
apt-get -y install nfs-common
showmount -e 服务端IP
mkdir /nfsdata
挂载,编辑/etc/fstabvim
vim /etc/fstab 添加: 服务端IP:/nfsdata /nfsdata nfs rw 0 0
mount -a
服务端随便建立一个文件,在客户端查看是否存在服务器