备份Base源

  1. cd /etc/yum.repos.d/
  2. cp CentOS-Base.repo CentOS-Base.repo.bak

更换阿里源

  1. wget -O /etc/yum.repos.d/CentOS-Base.repo https://mirrors.aliyun.com/repo/Centos-7.repo

更换清华源

  1. sudo sed -e 's|^mirrorlist=|#mirrorlist=|g' \
  2. -e 's|^#baseurl=http://mirror.centos.org|baseurl=https://mirrors.tuna.tsinghua.edu.cn|g' \
  3. -i.bak \
  4. /etc/yum.repos.d/CentOS-*.repo

更新

  1. yum makecache