1:在虚拟机ubuntu下安装NFS
sudo apt-get install nfs-kernel-server rpcbind
在根目下创建nfs文件夹,然后配置nfs ,使用如下命令打开nfs配置文件/etc/exports:
sudo vi /etc/exports
打开/etc/exports 以后在后面添加如下所示内容:
*/home/obey/linux/nfs (rw,sync,no_root_squash)
添加完成以后的/etc/exports
在这里插入图片描述
重启NFS,使用命令如下:
sudo /etc/init.d/nfs-kernel-server restart
查看NFS共享目录
确认共享的目录是否正确:
showmount -e
2:在开发板上搭建NFS客户端
确保在开发板上能ping 通ubuntu主机服务器
挂载开发板到ubuntu主机使用如下命令
root@ATK-IMX6U:~# mount -t nfs -o nolock,nfsvers=3 192.168.2.31:/home/obey/linux/nfs /mnt
root@ATK-IMX6U:~# cd /mnt
root@ATK-IMX6U:/mnt# ls
hello_word.txt
root@ATK-IMX6U:/mnt#
挂载成功后可以在ubuntu对的/home/obey/linux/nfs目录下创建一个hello_word.txt文件。然后在开发板上验证是否挂载成功。