1 #!/bin/bash 2 #Author:nulige 3 #Date: 2015-3-8 4 #实现功能:自动判断你的系统是Centos版本,适用于5.x或6.x 5 6 mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.$(date +%F)_backup 7 cd /etc/yum.repos.d/ 8 Ver=$(cat /etc/redhat-release |awk -F "." '{print $1}') 9 if [ "${Ver}" == "CentOS release 6" ] 10 then 11 wget http://mirrors.163.com/.help/CentOS6-Base-163.repo 12 else 13 wget http://mirrors.163.com/.help/CentOS5-Base-163.repo 14 fi 15 16 yum clean headers 17 yum makecache 18 sleep 2 19 echo -e "