参考文献:http://i.cnblogs.com/EditArticles.aspx?opt=1
脚本如下:
#!/bin/bash
#author hello.c
#date 20141030
yum install nfs-utils rpcbind -y
mkdir /opt/share_nfs
iptables -A INPUT -s 192.168.0.0/16 -j ACCEPT
service iptables save
service iptables restart
cat >> /etc/exports << EOF
/opt/share_nfs 192.168.0.0/16(rw,sync,no_root_squash)
EOF
service rpcbind start
service nfs start
#mount -t nfs 192.168.168.211:/opt/share_nfs /客户机 # 挂载实例
#cat "mount -t nfs 192.168.168.211:/opt/share_nfs /客户机 " >> /etc/rc.local #添加开机自动挂载