#!/bin/bash # this is a init script ping -c 1 -i 0.1 -W 1 baidu.com a=`echo $?` if [ ${a} == 0 ];then echo "network success" else echo "network failer" exit 2 fi systemctl stop firewalld systemctl disable firewalld sed -i 's/^SELINUX=enforcing/SELINUX=disable/' /etc/selinux/config hn=master1.localdomain hostnamectl set-hostname ${hn} # ----------------------------- mkdir /tmp/yum.repo.bak ;mv /etc/yum.repos.d/* /tmp/yum.repos.bak/ wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo wget -O /etc/yum.repos.d/epel.repo http://mirrors.aliyun.com/repo/epel-7.repo b=`echo $?` if [ ${b} == 0 ];then echo "yum 替换成功" else echo "yum 替换失败,将手动执行下列过程" exit 2 fi yum clean all;yum makecache
yum install -y wget vim 2>&1
reboot