1.卸载nfs清除配置
sudo apt-get remove --purge nfs-kernel-server
2.安装
sudo apt-get install nfs-kernel-server
3.配置
vim /etc/export
1 # /etc/exports: the access control list for filesystems which may be exporte d
2 # to NFS clients. See exports(5).
3 #
4 # Example for NFSv2 and NFSv3:
5 # /srv/homes hostname1(rw,sync,no_subtree_check) hostname2(ro,sync,no_ subtree_check)
6 #
7 # Example for NFSv4:
8 # /srv/nfs4 gss/krb5i(rw,sync,fsid=0,crossmnt,no_subtree_check)
9 # /srv/nfs4/homes gss/krb5i(rw,sync,no_subtree_check)
10 #
11 /home *(rw,sync,no_root_squash,no_subtree_check)
/home/aaa :要共享的目录
* ;允许所有网段访问
rw :读写权限
sync :同步写入
no_root_squash :nfs客户端拥有共享目录的使用权限
no_subtree_check : 不检测子目录
4.修改共享目录的权限
sudo chmod 777 /home/aaa
5.启动nfs服务
sudo service nfs-kernel-server restart
6.本机测试
sudo mount -t nfs localhost:/home/aaa /mnt
ls /mnt
touch /mnt/bb
ls /home/aaa
7.开发板测试
mount -t nfs -o nolock 本机ip:/home/aaa /mnt
8.卸载
unmount /mnt