1.更新源之前请先安装wget,下载repo要用
    # yum install -y wget
    2.备份并下载阿里云的base和epel源

    1. # mv -f /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.backup
    2. # wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo
    3. # mv /etc/yum.repos.d/epel.repo /etc/yum.repos.d/epel.repo.backup
    4. # wget -O /etc/yum.repos.d/epel.repo http://mirrors.aliyun.com/repo/epel-7.repo

    注:上面第三步如果没有epel.repo没关系,直接进行第四步下载该文件
    3.清理默认缓存包
    # yum clean all
    4.生成yum源缓存
    # yum makecache
    5.更新yum源
    # yum -y update