Linux开发环境搭建(四)

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/jnu_fangzebin/article/details/53386315

Ubuntu安装nfs服务器

在嵌入式开发中,nfs文件系统和TFTP是最常用的调试手段,一般编写好的程序都是通过这两种手段方便快捷下载到开发板中运行,但TFTP是将文件下载到开发板上,比较受限于开发板的存储空间,而nfs文件系统只是挂载到开发板上,基本是没有容量的限制的,所以我这边是采用nfs文件系统来进行调试。安装过程主要参考下面这两个链接。

Ubuntu 14.04安装配置NFS服务器_Linux | 帮客之家
Ubuntu 14.04下NFS安装配置

服务端(Ubuntu):

1.  # **sudo apt-get install nfs-kernel-server**
2.  # **mkdir /home/fangzebin/nfs**
3.  # **vi /etc/exports** //在文件最后加上下面这句,/home/fangzebin/nfs是要进行共享的文件夹
    **/home/fangzebin/nfs *(rw,sync,no_root_squash,no_subtree_check)** 
上面这条语句含义是:
    *:允许所有的网段访问,也可以使用具体的IP

    rw:挂接此目录的客户端对该共享目录具有读写权限

    sync:资料同步写入内存和硬盘

    no_root_squash:root用户具有对根目录的完全管理访问权限。

    no_subtree_check:不检查父目录的权限。
4. # **sudo /etc/init.d/rpcbind restart** //重启服务
5. # **/etc/init.d/nfs-kernel-server restart**
6. # **showmount -e**​ //测试指令,显示共享出来的文件夹

客户端(开发板)

1. 执行挂载指令:`# mount -t nfs  -o nolock 192.168.75.132:/home/fangzebin/nfs /home/fangzebin/Downloads`
指令解释:将目的IP主机的/home/fangzebin/nfs目录挂载到本机/home/fangzebin/Downloads上,目的IP也可是本机的IP

可能报错:
root@leon-VirtualBox:/home/leon# mount -t nfs 127.0.0.1:/home/leon/nfs /mnt
mount: wrong fs type, bad option, bad superblock on 127.0.0.1:/home/leon/nfs,
missing codepage or helper program, or other error
(for several filesystems (e.g. nfs, cifs) you might
need a /sbin/mount. helper program)
In some cases useful info is found in syslog - try
dmesg | tail or so
解决方法:
1. apt-get install nfs-common
2. 编译支持nfs的文件系统进行烧录

猜你喜欢

转载自blog.csdn.net/jnu_fangzebin/article/details/53386315