https://www.cnblogs.com/fanlinglong/p/8176870.html
# 备份原文件
mv /etc/yum.repos.d/CentOS-Base.repo{,.bak}
# 下载新的CentOS-Base.repo。
wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo
# 重建缓存
yum clean all
yum makecache
结果:
[root@ceos yum.repos.d]# yum makecache
已加载插件:fastestmirror, langpacks
Determining fastest mirrors
* base: mirrors.aliyun.com
* extras: mirrors.aliyun.com
* rpmforge: mirrors.tuna.tsinghua.edu.cn
* updates: mirrors.aliyun.com
http://mirrors.aliyuncs.com/centos/7/os/x86_64/repodata/repomd.xml: [Errno 12] Timeout on http://mirrors.aliyuncs.com/centos/7/os/x86_64/repodata/repomd.xml: (28, 'Connection timed out after 30000 milliseconds')
正在尝试其它镜像。
http://mirrors.cloud.aliyuncs.com/centos/7/os/x86_64/repodata/repomd.xml: [Errno 14] curl#6 - "Could not resolve host: mirrors.cloud.aliyuncs.com; 未知的错误"
正在尝试其它镜像。
base | 3.6 kB 00:00
extras | 3.4 kB 00:00
google-chrome | 951 B 00:00
rpmforge | 1.9 kB 00:00
updates | 3.4 kB 00:00
(1/12): base/7/x86_64/group_gz | 166 kB 00:01
(2/12): base/7/x86_64/filelists_db | 6.9 MB 00:52
(3/12): base/7/x86_64/primary_db | 5.9 MB 00:52
(4/12): extras/7/x86_64/prestodelta | 84 kB 00:03
(5/12): extras/7/x86_64/primary_db | 187 kB 00:01
(6/12): base/7/x86_64/other_db | 2.5 MB 00:06
(7/12): extras/7/x86_64/other_db | 120 kB 00:01
(8/12): extras/7/x86_64/filelists_db | 595 kB 00:06
(9/12): updates/7/x86_64/prestodelta | 538 kB 00:05
(10/12): updates/7/x86_64/filelists_db | 2.9 MB 00:10
(11/12): updates/7/x86_64/other_db | 478 kB 00:01
(12/12): updates/7/x86_64/primary_db | 5.2 MB 00:11
(1/6): google-chrome/filelists | 1.9 kB 00:00
(2/6): google-chrome/primary | 1.9 kB 00:00
(3/6): google-chrome/other | 481 B 00:00
(4/6): rpmforge/primary_db | 7.0 MB 00:56
(5/6): rpmforge/filelists_db | 6.1 MB 00:59
(6/6): rpmforge/other_db | 1.5 MB 00:13
google-chrome 3/3
google-chrome 3/3
google-chrome 3/3
元数据缓存已建立
[root@ceos yum.repos.d]# yum makecache
已加载插件:fastestmirror, langpacks
Loading mirror speeds from cached hostfile
* base: mirrors.aliyun.com
* extras: mirrors.aliyun.com
* rpmforge: mirrors.tuna.tsinghua.edu.cn
* updates: mirrors.aliyun.com
base | 3.6 kB 00:00
extras | 3.4 kB 00:00
google-chrome | 951 B 00:00
rpmforge | 1.9 kB 00:00
updates | 3.4 kB 00:00
元数据缓存已建立
[root@ceos yum.repos.d]#