在linux主机之间可以用NFS服务实现文件共享,而且实现起来也十分方方便,本篇文章重点为大家讲解一下redhat7 配置文件共享服务具体方法。

NFS简介
nfs在在消息传递过程中依赖RPC协议,使用NFS时用户端只需要使用mount命令将远程主机的目录挂载到本地即可。 例如要把10.10.0.12的/home/test挂载到本地10.10.0.11的/home/test目录下
[root@localhost ~]# mount 10.10.0.12:/home/test /home/test
配置NFS服务器
NFS 需要安装nfs-utils*.rpm rpcbind*.rpm
版本号因系统版本有所差别
[root@localhost ~]# yum install -y nfs-utils rpcbind
......
exports参数说明
-a 全部挂载/etc/exports 文件内的设置,-r 重新挂载/etc/exports 文件内的设置,-u卸载某一目录
shownmount参数说明
-a 列出nfs共享的完整目录信息,-d 列出客户端远程安装的目录,-e 显示导出目录的列表
nfs参数说明
ro 只读权限,rw 读写权限,all_squash匿名用户或组,no_all_squash 非匿名用户或组,root_squash将root用户和组映射为匿名用户和组,no_root_squash 与root_squash相反,sync 将数据同步写入缓冲区中,async 将数据先保存在内存缓冲区,再写入磁盘
设置expoprts 文件
[root@localhost ~]# cat /etc/exports
/home/test *.*(rw)
启动服务
[root@localhost ~]# systemctl start rpcbind
[root@localhost ~]# systemctl start nfs-server
配置NFS客户端
[root@localhost ~]# mount -t nfs -o rw 10.10.0.12:/home/test /home/test
如此,就可以使用!
以上就是良许教程网为各位朋友分享的Linux系统相关内容。想要了解更多Linux相关知识记得关注公众号“良许Linux”,或扫描下方二维码进行关注,更多干货等着你 !
