●依赖于RPC (远端过程调用)
●需安装nfs-utils、rpcbind软件包
●系统服务: nfs、 rpcbind
●共享配置文件: /etc/exports
[root@localhost other]# yum -y install nfs-utils
[root@localhost other]# yum -y install rpcbind
[root@localhost other]# mkdir /opt/wwwroot/
[root@localhost other]# vi /etc/exports
/opt/wwwroot 20.0.0.0/24(rw,sync,no_root_squash)
/opt/ftp/pub 20.0.0.12(ro) 20.0.0.13(rw)
[root@localhost other]# systemctl start nfs
[root@localhost other]# systemctl start rpcbind
[root@localhost other]# systemctl enable rpcbind
[root@localhost other]# systemctl enable nfs
[root@localhost other]# showmount -e
[root@localhost ~]# yum -y install rpcbind ##访问需要安装RPC工具
[root@localhost ~]# yum -y install showmount ##安装showmount工具用于查看共享目录
[root@localhost ~]# showmount -e 20.0.0.11
[root@localhost ~]# mkdir /var/www
设置临时挂载
[root@localhost ~]# mount 20.0.0.11:/opt/wwwroot /var/www/(临时挂载)
[root@localhost ~]# tail -1 /etc/mtab
(1)服务器端写入数据
[root@localhost other]# cd /opt/wwwroot
[root@localhost wwwroot]# ll
total 0
[root@localhost wwwroot]# touch 1.txt
[root@localhost wwwroot]# echo 158313213456123 > 1.txt
[root@localhost wwwroot]# cat 1.txt
158313213456123
客户端查看(测试无误,能看到完整数据)
[root@localhost ~]# cd //var/www
[root@localhost www]# ll
total 4
-rw-r–r-- 1 root root 16 Aug 2 16:13 1.txt
[root@localhost www]# cat 1.txt
158313213456123
(2)客户端写入数据
[root@localhost www]# cd /var/www
[root@localhost www]# touch 2.txt
[root@localhost www]# echo 2222222222 > 2.txt
[root@localhost www]# cat 2.txt
2222222222
服务器端查看(数据无误,测试成功)
[root@localhost wwwroot]# cd /opt/wwwroot
[root@localhost wwwroot]# ll
total 8
-rw-r–r--. 1 root root 16 Aug 2 16:13 1.txt
-rw-r–r--. 1 root root 11 Aug 2 16:16 2.txt
[root@localhost wwwroot]# cat 2.txt
2222222222
Copyright © QY Network Company Ltd. All Rights Reserved. 2003-2018 群英 版权所有 茂名市群英网络有限公司
增值电信经营许可证 : B1.B2-20140078 粤ICP备09006778号-36 粤公网安备 44090202000006号 粤工商备P091701000595