1、备份本地源

root@localhost yum.repos.d]# cp CentOS-Base.repo  CentOS-Base_Backup.repo 

  

2、获取阿里yum官方源

[root@localhost yum.repos.d]# wget -O /etc/yum.repos.d/CentOS-Base.repo  http://mirrors.aliyun.com/repo/Centos-7.repo

3、更新yum缓存

[root@localhost yum.repos.d]# yum makecache

4、获取阿里epel源

[root@localhost yum.repos.d]# wget -O /etc/yum.repos.d/epel.repo http://mirrors.aliyun.com/repo/epel-7.repo

5、更新缓存

[root@localhost yum.repos.d]# yum makecache

6、查看yum源

[root@localhost yum.repos.d]# yum repolist
Loaded plugins: fastestmirror
Repository base is listed more than once in the configuration
Repository updates is listed more than once in the configuration
Repository extras is listed more than once in the configuration
Repository centosplus is listed more than once in the configuration
Loading mirror speeds from cached hostfile
 * base: mirrors.aliyun.com
 * extras: mirrors.aliyun.com
 * updates: mirrors.aliyun.com
repo id                   repo name                                                status
base/7/x86_64             CentOS-7 - Base - mirrors.aliyun.com                     10,070
epel/x86_64               Extra Packages for Enterprise Linux 7 - x86_64           13,441
extras/7/x86_64           CentOS-7 - Extras - mirrors.aliyun.com                      413
updates/7/x86_64          CentOS-7 - Updates - mirrors.aliyun.com                   1,127
repolist: 25,051
You have new mail in /var/spool/mail/root

  

 

posted on 2020-09-10 15:48  草根920  阅读(372)  评论(0编辑  收藏  举报