CentOS7更换源

centos7

阿里云yum源:
一、备份当前yum源防止出现意外还可以还原回来

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

二、使用wget下载阿里yum源repo文件

  • wget http://mirrors.aliyun.com/repo/Centos-7.repo(更具自己的CentOS版本下载)

三、清理旧包

  • yum clean all

四、把下载下来阿里云repo文件设置成为默认源

  • mv Centos-7.repo CentOS-Base.repo

五、生成阿里云yum源缓存并更新yum源

  • yum makecache
  • yum update
原文地址:https://www.cnblogs.com/netian/p/14101562.html