CentOS换源:解决Error: Failed to cache for repo ‘AppStream’
1.前言
在CentOS 8上用yum安装wget时,出现错误:Error: Failed to synchronize cache for repo 'AppStream',如下图所示:
想着可能需要升级一下yum,结果还是同样的错误。
2.解决方法
其实就是因为默认的源不行了,换个源就完事了,这里演示的是换阿里云的源。具体来说,需要修改/etc/yum.repos.d下的四个文件:“CentOS-AppStream.repo”,“CentOS-Base.repo”,“CentOS-Extras.repo”,“CentOS-PowerTools.repo”。
这里推荐用FinalShell,文件修改只需要下载到本地,编辑完了后,按Ctrl+S保存就会自动上传覆盖,简单快速。
分别将对应文件替换为下面的内容,建议复制后直接覆盖原来文件里面的所有内容就行。
2.1 CentOS-AppStream.repo
# CentOS-AppStream.repo
#
# The mirror system uses the connecting IP address of the client and the
# update status of each mirror to pick mirrors that are updated to and
# geographically close to the client. You should use this for CentOS updates
# unless you are manually picking other mirrors.
#
# If the mirrorlist= does not work for you, as a fall back you can try the
# remarked out baseurl= line instead.
#
#
[AppStream]
name=CentOS-$releasever - AppStream
baseurl=https://mirrors.aliyun.com/centos/8-stream/AppStream/$basearch/os/
gpgcheck=1
enabled=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial
2.2 CentOS-Base.repo
# CentOS-Extras.repo
#
# The mirror system uses the connecting IP address of the client and the
# update status of each mirror to pick mirrors that are updated to and
# geographically close to the client. You should use this for CentOS updates
# unless you are manually picking other mirrors.
#
# If the mirrorlist= does not work for you, as a fall back you can try the
# remarked out baseurl= line instead.
#
#
#additional packages that may be useful
[extras]
name=CentOS-$releasever - Extras
baseurl=https://mirrors.aliyun.com/centos/8-stream/extras/$basearch/os/
gpgcheck=1
enabled=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial
2.3 CentOS-Extras.repo
# CentOS-Extras.repo
#
# The mirror system uses the connecting IP address of the client and the
# update status of each mirror to pick mirrors that are updated to and
# geographically close to the client. You should use this for CentOS updates
# unless you are manually picking other mirrors.
#
# If the mirrorlist= does not work for you, as a fall back you can try the
# remarked out baseurl= line instead.
#
#
#additional packages that may be useful
[extras]
name=CentOS-$releasever - Extras
baseurl=https://mirrors.aliyun.com/centos/8-stream/extras/$basearch/os/
gpgcheck=1
enabled=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial
2.4 CentOS-PowerTools.repo
# CentOS-PowerTools.repo
#
# The mirror system uses the connecting IP address of the client and the
# update status of each mirror to pick mirrors that are updated to and
# geographically close to the client. You should use this for CentOS updates
# unless you are manually picking other mirrors.
#
# If the mirrorlist= does not work for you, as a fall back you can try the
# remarked out baseurl= line instead.
#
#
[PowerTools]
name=CentOS-$releasever - PowerTools
baseurl=https://mirrors.aliyun.com/centos/8-stream/PowerTools/$basearch/os/
gpgcheck=1
enabled=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial
3.检验
重新执行命令:
yum -y install wget
可以看到能够正常安装了。
版权声明:
作者:admin
链接:https://ccvxx.cn/?p=88
来源:涼城的小站-个人日常经验总结
文章版权归作者所有,未经允许请勿转载。
THE END
0
二维码
海报
CentOS换源:解决Error: Failed to cache for repo ‘AppStream’
1.前言
在CentOS 8上用yum安装wget时,出现错误:Error: Failed to synchronize cache for repo 'AppStream',如下图所示:
想着可能需要升级一下yum,结果还……
涼城的小站-个人日常经验总结
共有 0 条评论