准备一台主机安装nfs存储卷
#ip 192.168.0.15
yum install -y nfs-common nfs-utils rpcbind
mkdir /nfsdata
chmod 666 /nfsdata/
chown nfsnobody /nfsdata/
cat >> /etc/exports <<EOF
/nfsdata *(rw,no_root_squash,no_all_squash,sync)
EOF
systemctl start rpcbind
systemctl start nfs
准备另一台主机使用nfs
#使用nfs的主机都需要安装nfs模块
yum install -y nfs-common nfs-utils rpcbind
#查看nfs主机
[root@client nfsdata]# showmount -e 192.168.0.15
Export list for 192.168.0.15:
/nfsdata *
#创建空目录,挂在远程nfs
mount -t nfs 192.168.0.15:/nfsdata /nfsdata
#创建一个文件测试
cd /nfsdata/
echo "text" > test.txt
#查看两台主机/nfsdata目录下均已存在test.txt文件