######NFS服务端A##### IP:192.168.10.110 5.8对应的就是portmap
yum -y install nfs-utils portmap
vi /etc/selinux/config
修改成disabled
/etc/init.d/iptables stop
/etc/init.d/portmap restart
/etc/init.d/nfs restart
echo "###portmap by wanchong 201402">>/etc/rc.local
echo "/etc/init.d/portmap restart">>/etc/rc.local
echo "###nfs by oldboy 201402">>/etc/rc.local
echo "/etc/init.d/nfs restart">>/etc/rc.local
mkdir /data/w_shared -p
mkdir /data/r_shared -p
chown -R nfsnobody.nfsnobody /data/w_shared/
ls -ld /data/w_shared
echo "#read only dir by wanchong " >>/etc/exports
echo "/data/r_shared 192.168.10.0/24(ro)" >>/etc/exports 如果不行就在(加上no_root_squash)
echo "#rw only dir by wanchong " >>/etc/exports
echo "/data/w_shared 192.168.10.0/24(rw,sync)">>/etc/exports
tail -4 /etc/exports
/etc/init.d/nfs reload = expoetfs -rv
chmod 777 /data/w_shared
#####NFS客户端B##### IP:192.168.10.111 6.2对应的就是rpcbind
yum -y install nfs-utils rpcbind
/etc/init.d/rpcbind restart
echo "###rpc bind by wanchong 201402">>/etc/rc.locl
echo "/etc/init.d/rpcbind restart" >>/etc/rc.local
tail -2 /etc/rc.local
mkdir /data/b_w
mkdir /data/b_r
showmount -e 192.168.6.110
mount -t nfs 192.168.10.110:/data/w_shared /data/b_w
mount -t nfs 192.168.6.110:/data/r_shared /data/b_r
######NFS客户端C#### IP:192.168.10.112 5.8对应的就是portmap
echo "/etc/portmap restart" >>/etc/rc.local
mkdir /data/w_wanchong
mkdir /data/r_wanchong
showmount -e 192.168.10.110
mount -t nfs 192.168.10.110:/data/w_shared /data/w_wanchong
mount -t nfs 192.168.10.110:/data/r_shared /data/r_wanchong
检查测试:
在服务端目录创建目录