系统环境
主机系统:ubuntu 14.04 LTS 32bits
BBB:版本A5C 运行系统:Angostrom
主机端NFS服务器搭建:
ubuntu主机操作
1. sudo apt-get install nfs-kernel-server //在ubuntu主机, 安装NFS
2. 建立主机NFS 共享文件:
sudo mkdir /home/bbb_nfs
sudo chmod -R 777 /home/bbb_nfs
3. 设置共享文件添加进NFS,及其配置权限:
sudo gedit /etc/exports // 编辑其内容
# /etc/exports: the access control list for filesystems which may be exported
# to NFS clients. See exports(5).
/home/bbb_nfs *(rw) #可配置其相应权限
4. sudo /etc/init.d/nfs-kernel-server restart //重启NFS使配置生效5. showmount -e localhost //查看exports输出到客户端列表
显示如下:NFS 主机端就配置好咧
Export list for localhost:
/home/bbb_nfs
BBB NFS 客户端搭建:
目标板BBB操作:(记得要让她联网哦!)
1. opkg update # 更新源文件
2. opkg list | grep portmap // 搜索有关portmap安装包
portmap - 6.0-r7.2 - portmap version 6.0-r7
portmap-dbg - 6.0-r7.2 - portmap version 6.0-r7 - Debugging files
portmap-dev - 6.0-r7.2 - portmap version 6.0-r7 - Development files
portmap-doc - 6.0-r7.2 - portmap version 6.0-r7 - Documentation files
portmap-utils - 6.0-r7.2 - portmap version 6.0-r7
3 . opkg install portmap-dev // 安装portmap4. opkg list | grep nfs // 搜索有关nfs的安装包
libnfsidmap-dbg - 0.25-r0.2 - NFS id mapping library - Debugging files
libnfsidmap-dev - 0.25-r0.2 - NFS id mapping library - Development files
libnfsidmap-doc - 0.25-r0.2 - NFS id mapping library - Documentation files
libnfsidmap-staticdev - 0.25-r0.2 - NFS id mapping library - Development files )
libnfsidmap0 - 0.25-r0.2 - NFS id mapping library
nfs-utils - 1.2.3-r5.3 - userspace utilities for kernel nfs
The nfs-utils package provides a daemon for the kernel NFS server and
nfs-utils-client - 1.2.3-r5.3 - userspace utilities for kernel nfs
The nfs-utils package provides a daemon for the kernel NFS server and
nfs-utils-dbg - 1.2.3-r5.3 - userspace utilities for kernel nfs - Debugging fils
The nfs-utils package provides a daemon for the kernel NFS server and
nfs-utils-dev - 1.2.3-r5.3 - userspace utilities for kernel nfs - Development fs
The nfs-utils package provides a daemon for the kernel NFS server and
nfs-utils-doc - 1.2.3-r5.3 - userspace utilities for kernel nfs - Documentations
The nfs-utils package provides a daemon for the kernel NFS server and
nfs-utils-stats - 1.2.3-r5.3 - userspace utilities for kernel nfs
The nfs-utils package provides a daemon for the kernel NFS server and
5. opkg install nfs-utils-dev // 安装nfs客户端6. root@beaglebone:# mkdir /mnt/nfs
root@beaglebone:# mount -t nfs -o nolock,nfsvers=3,vers=3 192.168.7.1:/home/bbb_nfs /mnt /nfs //挂载分享目录
7. 至此,可以在BBB上的目录/mnt/nfs下, 操作主机上 /home/bbb_nfs 目录下的文件了
回顾与注意
以上构建了一个微小的NFS服务器,方便了主机和目标板的文件共享及传输,在开发系统时可以极大提高开发的效率。
主机和BBB board 都要联网操作,BBB 我用的是系统自带USB转网络通讯模式,主机我设置相应的站点:192.168.7.1.
主要参考列表:
1.鸟哥的linux私房菜《伺服器》:第十三章、檔案伺服器之一:NFS伺服器