更换yum源

备份自带yum源
[root@localhost ~]# cp /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.default
[root@localhost ~]# cp /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.bak
 
 
 
下载阿里云yum源(也可使用其它国内yum源)
[root@localhost ~]# curl -o /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo
 
 
 
刷新yum缓存,确保使用新的源
[root@localhost ~]# yum clean all
[root@localhost ~]# yum makecache
 
 
 
查看当前使用yum源
[root@localhost ~]# yum repolist

Copyright © 2024 码农人生. All Rights Reserved