[root@localhost / ]# cat epel_repo_CentOS6.0.sh

#!/bin/bash
################################################################################
#Description : 用于添加CentOS系统RPM包源                                       #
#Last Update : 2012-5-23                                                       #
#Author : aimin                                                                #
#E-mail :                                                      #
################################################################################

rebuild_repo()

{
cd /etc/yum.repos.d
MIRRORS_CF=( CentOS-Base.repo CentOS-Debuginfo.repo CentOS-Media.repo )
for CFG  in ${MIRRORS_CF[@]}
  do
    [ -e $CFG ]  && mv ${CFG}{,.bak}
done

yum makecache

}

add_mirrors_163()

{
curl -s -o /etc/yum.repos.d/CentOS-163.repo
}

add_mirrors_epel()

{
curl -s -o /tmp/epel-release-6-7.noarch.rpm
rpm -ivh /tmp/epel-release-6-7.noarch.rpm
}

#这里有两个yum源,实际使用过程中我发现epel中的有些程序要比centos本身的源程序包要新,所以有时候安装不上程序时,可以试着关闭掉epel仓库
add_mirrors_163
add_mirrors_epel

rebuild_repo