NFS的使用:
主机 192.168.189.129
备份机 192.168.189.130
实验操作:准备一台服务器当存储服务器,在其上部署nfs(192.168.189.129)
1)机器下载 rpcbind 和 nfs-utils
yum -y install rpcbind nfs-utils
开启服务,并在主服务器设置开机自启
linux 6:
service rpcbind start
service nfs start
chkconfig rpcbind on
chkconfig nfs on
linux 7:
systemctl start rpcbind
systemctl enable rpcbind
systemctl start nfs
systemctl enable nfs
2)准备一个共享目录
mkdir /opt/html
3)编辑共享文件
编辑共享文件
vim /etc/exports
/opt/html 192.168.189.0/24(rw,no_root_squash) #赋予读写权限
重载共享配置文件
exportfs -rv
关闭相关防火墙,selinux
linux 6:
service iptables stop
setenforce 0
linux 7:
systemctl stop firewalld
setenforce 0
4) 在客户端挂载该共享目录(192.168.189.130)
首先下载nfs
yum -y install nfs-utils
下一步:
挂载129机器
showmout -e 192.168.189.129
如果可以看到共享的目录,说明可以执行挂载该目录了
mount -t nfs 192.168.189.129:/opt/html /var/www/html
执行mount命令查看是否挂载成功
mount
成功:192.168.189.129:/opt/html on /var/www/html type nfs (rw,vers=4,addr=192.168.189.129,clientaddr=192.168.189.130)
标签:rpcbind,192.168,189.129,html,nfs,服务器,共享
来源: https://www.cnblogs.com/security-guard/p/12076046.html