如有转载,请注明出处:http://blog.youkuaiyun.com/embedded_sky/article/details/20476349
作者:super_bert@csdn
此部分属于开发环境搭建,ubuntu10.04
安装NFS服务器 :
#apt-get install nfs-kernel-server
修改NFS配置文件
#vim /etc/exports :
在文件中添加NFS的目录格式如下,并保存退出
/root/worknfs *(rw,sync,no_root_squash)
在根目录下建立nfs的目录,并修改目录权限:
#mkdir /root/worknfs
#chmod 777 -R /root/worknfs
配置/etc/hosts.deny ,禁止任何host(主机)能和你的NFS服务器进行NFS连接),
#vim /etc/hosts.deny
加入如下内容,保存退出。
### NFS DAEMONS
portmap:ALL
lockd:ALL
mountd:ALL
rquotad:ALL
statd:ALL
配置/etc/hosts.allow ,允许那些你想要的主机和你的NFS服务器建立连接。下列步骤将允许任何IP地址以10.10.204.开头的主机(连 接到NFS服务器上),也可以指定特定的IP地址。参看man页hosts_access(5), hosts_options(5)。
#vim/etc/hosts.allow
加入如下内容,保存退出。
portmap:10.10.204.
locked:10.10.204.
rquotad:10.10.204.
mountd:10.10.204.
statd:10.10.204.
重启NFS服务器:
#/etc/init.d/nfs-kernel-server restart
可用以下命令测试NFS服务器:
#mount 10.10.204.210:/root/worknfs /mnt/nfs
在开发板上则要用以下命令挂载共享目录:
# mount -t nfs -o nolock -o tcp 10.10.204.210:/root/worknfs /mnt/nfs