首页 > 其他 > 详细

NFS服务脚本形式安装实例

时间:2018-08-08 16:06:26      阅读:166      评论:0      收藏:0      [点我收藏+]
#!/bin/bash CLIENT_IP=$1 MOUNT_POINT=$2 STOREAGE=/data SERVER_IP=$(ip a|grep ‘inet ‘|egrep -v ‘127.0.0.1|grep‘|awk -F ‘[ /]+‘ ‘{print $3}‘) #close firewalld and selinux setenforce 0 sed -ri ‘s/^(SELINUX=).*/\1disabled/g‘ /etc/sysconfig/selinux systemctl stop firewalld systemctl disable firewalld #install software yum clean all &>/dev/null if [ $? -ne 0 ];then cd /etc/yum.repos.d/ curl -o 163.repo http://mirrors.163.com/.help/CentOS7-Base-163.repo sed -i ‘s/\$releasever/7/g‘ /etc/yum.repos.d/163.repo else yum install nfs‐utils ‐y &>/dev/null yum install rpcbind ‐y &>/dev/null fi echo "$STORAGE ${CLIENT_IP}(rw,async)" > /etc/exports if [ ! -d $STORAGE ];then mkdir -p $STORAGE chmod 777 $STORAGE chown ‐R nfsnobody.nfsnobody $STORAGE fi systemctl start nfs‐server &>/dev/null ssh root@$CLIENT_IP ‘yum -y install nfs-utils‘ ssh root@$CLIENT_IP "showmount ‐e $SERVER_IP" ssh root@$CLIENT_IP "mkdir -p $MOUNT_POINT" ssh root@$CLIENT_IP "mount ‐t nfs ${SERVER_IP}:$STORAGE $MOUNT_POINT"

NFS服务脚本形式安装实例

原文:http://blog.51cto.com/13858192/2156274

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!