【转载】完美解决CentOS8 yum安装AppStream报错,更新yum后无法makecache的问题
问题
CentOS 8 yum安装软件时,提示无法从AppStream下载
1 2 3 4 5 6 7 8 9 | [root@C8-3 ~]# yum -y install httpd mariadb-server mariadb php php-mysql Repository AppStream is listed more than once in the configuration Repository extras is listed more than once in the configuration Repository PowerTools is listed more than once in the configuration Repository centosplus is listed more than once in the configuration Repository fasttrack is listed more than once in the configuration CentOS-8 - AppStream 0.0 B/s | 0 B 00:08 Failed to download metadata for repo 'AppStream' Error: Failed to download metadata for repo 'AppStream' |
更换国内yum源
- 阿里yum源: https://developer.aliyun.com/mirror/centos
- 腾云yum源: https://mirrors.tencent.com/help/centos.html
1 2 | # mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.backup.3 # wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.cloud.tencent.com/repo/centos8_base.repo |
清理之前的yum缓存
1 | # yum clean all |
建立新的缓存
1 | # yum makecache |
解决makecahe报错
centos8会出现以下报错
1 2 3 | CentOS-8 - AppStream 0.0 B/s | 0 B 00:04 Failed to download metadata for repo 'AppStream' Error: Failed to download metadata for repo 'AppStream' |
解决办法
- 将CentOS-AppStream.repo文件中的链接更新
1 | # vim /etc/yum.repos.d/CentOS-AppStream.repo |
- 注释掉原有内容,并插入新内容
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | #这一段注释掉< br >#[AppStream] #name=CentOS-$releasever - AppStream #mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=AppStream&infra=$infra #baseurl=http://mirror.centos.org/$contentdir/$releasever/AppStream/$basearch/os/ #mirrorlist=http://mirror.centos.org/$contentdir/$releasever/AppStream/$basearch/os/ #gpgcheck=1 #enabled=1 #pgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial < br >#改为下面这段 [AppStream] name=Qcloud centos AppStream - $basearch baseurl=http://mirrors.cloud.tencent.com/centos/$releasever/AppStream/$basearch/os/ enabled=0 gpgcheck=1 gpgkey=http://mirrors.cloud.tencent.com/centos/RPM-GPG-KEY-CentOS-Official |
- 重新运行 # yum makecache
1 | # yum makecache |
分类:
CentOS
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· winform 绘制太阳,地球,月球 运作规律
· AI与.NET技术实操系列(五):向量存储与相似性搜索在 .NET 中的实现
· 超详细:普通电脑也行Windows部署deepseek R1训练数据并当服务器共享给他人
· 上周热点回顾(3.3-3.9)
· AI 智能体引爆开源社区「GitHub 热点速览」
2018-05-05 The parent project must have a packaging type of POM
2018-05-05 oracle中PLSQL存储过程中如何使用逗号分隔的集合(逗号分隔字符串转换为一个集合)