mount nfs

服务器S1:prod,192.168.1.10
服务器S2:prod,192.168.1.11
系统:centos7
目标:S1共享S2的文件目录/opt/test/test1

1.安装nfs(每个服务器都需安装)
检测nfs是否安装:

rpm -qa |grep nfs

安装:

yum install nfs-utils

2.修改S2的/etc/exports
添加:

/opt/test 192.168.1.10(rw,no_root_squash,async)

重启nfs:

service nfs restart

3.mount

 mount -t nfs 192.168.1.11:/opt/test/test1 /opt/test/test2

注:如果S2开了防火墙,需要开放端口111、2049、4046给S1

4.开放端口

firewall-cmd --permanent --add-rich-rule="rule family="ipv4" source address="192.168.1.10" port protocol="tcp" port="111" accept"
firewall-cmd --permanent --add-rich-rule="rule family="ipv4" source address="192.168.1.10" port protocol="tcp" port="2049" accept"
firewall-cmd --permanent --add-rich-rule="rule family="ipv4" source address="192.168.1.10" port protocol="tcp" port="4046" accept"
firewall-cmd --reload

5.查看挂载信息

mount | grep nfs

你可能感兴趣的:(linux)