一、备份原来的yum源,以防后续使用

cd /etc/yum.repos.d/;mkdir bak/; mv *.repo bak/

  二、下载阿里云的base源

Centos6:

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

或者:

curl -o /etc/yum.repos.d/CentOS-Base.repo https://mirrors.aliyun.com/repo/Centos-6.repo

Centos7:

 wget https://mirrors.aliyun.com/repo/Centos-7.repo

或者:

curl -o /etc/yum.repos.d/CentOS-Base.repo https://mirrors.aliyun.com/repo/Centos-7.repo

Centos:8

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

或者:

curl -o /etc/yum.repos.d/CentOS-Base.repo https://mirrors.aliyun.com/repo/Centos-8.repo

  三、下载阿里云的epel源

 wget -O /etc/yum.repos.d/epel.repo http://mirrors.aliyun.com/repo/epel-7.repo

  四、清除缓存并生成新的缓存

yum clean all && yum makecache

#生成缓存需要时间,可以直接显示当前可用yum源

yum clean all && yum repolist

 

相关文章:

  • 2021-10-06
  • 2021-12-17
  • 2022-12-23
  • 2022-12-23
  • 2021-08-28
  • 2021-06-02
  • 2022-12-23
猜你喜欢
  • 2022-01-14
  • 2021-07-17
  • 2021-04-22
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案