您的位置:首页 > 运维架构 > Linux

NFS实现linux系统间文件共享

2016-06-28 10:26 627 查看
一般用在交叉编译环境中,host和target之间的文件共享。

host安装nfs服务

sudo apt-get install nfs-kernel-server portmap


修改nfs配置文件

sudo vim  /etc/exports


添加

/home/shuaige/nfs 192.168.9.*(rw,sync,no_root_squash)


第一个表示把host上的这个目录作为共享目录

第二个表示允许这些ip地址申请共享目录

第三个表示设置权限

重启nfs服务

sudo /etc/init.d/nfs-kernel-server restart


测试nfs

showmount -e


target连接nfs

登录target,运行命令:

sudo mount -o nolock -t nfs 192.168.0.10:/home/shuaige/nfs /mnt


192.168.0.10是host的ip地址

192.168.0.10:/home/shuaige/nfs 表示nfs服务器允许的共享文件夹

/mnt 表示target上挂载路径,在target上可以通过/mnt这个文件夹,和host进行文件共享。
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: