报错如下
Failed to synchronize cache for repo ‘AppStream’, ignoring this repo.
Failed to synchronize cache for repo ‘BaseOS’, ignoring this repo.
由于无法连接官方网站导致,切换国内镜像源即可
国内源:
- 阿里yum源:mirrors.aliyun.com
- 腾讯yum源:mirrors.cloud.tencent.com
- 网易yum源:mirrors.163.com
- 清华yum源:mirrors.tuna.tsinghua.edu.cn
操作
将代码中替换相应源即可
sed -i 's/^mirrorlist/#mirrorlist/g' /etc/yum.repos.d/CentOS-*
sed -i 's|#baseurl=http://mirror.centos.org|baseurl=http://mirrors.aliyun.com|g' /etc/yum.repos.d/CentOS-*
yum clean all
yum makecache
注意,部分更新后可能还有新的文件出现,此时可以再次执行一次上述操作即可