yum install -y yum-priorities
#安装yum优先级插件(本文优先级设置为阿里,163,中科大,epel)
cd /etc/yum.repos.d
#CentOS6
wget -O CentOS6-aliyun.repo http://mirrors.aliyun.com/repo/Centos-6.repo
wget -O CentOS6-163.repo http://mirrors.163.com/.help/CentOS6-Base-163.repo
wget -O CentOS6-ustc.repo https://lug.ustc.edu.cn/wiki/_export/code/mirrors/help/centos?codeblock=2
yum -y install epel-release
#CentOS7
wget -O CentOS7-aliyun.repo http://mirrors.aliyun.com/repo/Centos-7.repo
wget -O CentOS7-163.repo http://mirrors.163.com/.help/CentOS7-Base-163.repo
wget -O CentOS7-ustc.repo https://lug.ustc.edu.cn/wiki/_export/code/mirrors/help/centos?codeblock=3
yum -y install epel-release
#配置priority
#确认启用配置优先级功能,priority=n ∈(1~99), 值越小,优先级越高。
#分别在对应的*.repo文件中设置好优先级
#示例:
echo >> CentOS7-aliyun.repo
echo "priority=1" >> CentOS7-aliyun.repo