NFS-server操作
[root@nfs-server ~]# yum -y install rpcbind #安装rpc协议的包
[root@nfs-server ~]# yum -y install nfs-utils #安装nfs服务,提供文件系统
启动服务
[root@nfs-server ~]# systemctl start nfs
[root@nfs-server ~]# systemctl start rpcbind
[root@nfs-server ~]# mkdir /nfs-dir #创建存储目录
[root@nfs-server ~]# echo "nfs-test" >> /nfs-dir/index.html #制作test文件
[root@nfs-server ~]# vim /etc/exports #编辑共享文件
/nfs-dir 192.168.246.0/24(rw,no_root_squash,sync)客户端
web1 客户端操作
[root@web1 ~]# yum -y install rpcbind
[root@web1 ~]# yum -y install nfs-utils
[root@web1 ~]# mkdir /qf #创建挂载点
服务端
[root@web1 ~]# mount -t nfs 192.168.246.160:/nfs-dir /qf #挂载
[root@web1 ~]# df -Th
Filesystem Type Size Used Avail Use% Mounted on
/dev/mapper/centos-root xfs 17G 1.1G 16G 7% /
tmpfs tmpfs 98M 0 98M 0% /run/user/0
192.168.246.160:/nfs-dir nfs4 17G 1.4G 16G 8% /qf
[root@web1 ~]# ls /qf
index.html
[root@web1 ~]# umount /qf #取消挂载