【已解决】Error Failed to download metadata for repo ‘appstream‘ t

【已解决】Error: Failed to download metadata for repo ‘appstream’: Cannot prepare internal mirrorlist: No URLs in mirrorlist

出现问题

在学习docker技术和hadoop过程中,需要安装 net-tools,然而安装时出现了错误提示信息

[root@39afa23537e2 /]# ifconfig 
bash: ifconfig: command not found
[root@39afa23537e2 /]# yum install net-tools
Failed to set locale, defaulting to C.UTF-8
CentOS Linux 8 - AppStream         70  B/s |  38  B     00:00    
Error: Failed to download metadata for repo 'appstream': Cannot prepare internal mirrorlist: No URLs in mirrorlist

上述报错信息字面意思是:从仓库 ‘appstream’ 下载元数据失败:由于镜像列表中没有 URL,不能准备内部镜像列表。

问题分析

可能原因1:网络连接问题。检查是否可以连接外部网络,可以使用 ping baidu.com 查看是否有丢包情况。

[root@localhost ~]# ping baidu.com
PING baidu.com (110.242.68.66) 56(84) bytes of data.
64 bytes from 110.242.68.66 (110.242.68.66): icmp_seq=1 ttl=48 time=33.3 ms
64 bytes from 110.242.68.66 (110.242.68.66): icmp_seq=2 ttl=48 time=32.8 ms
64 bytes from 110.242.68.66 (110.242.68.66): icmp_seq=3 ttl=48 time=32.7 ms
64 bytes from 110.242.68.66 (110.242.68.66): icmp_seq=4 ttl=48 time=38.2 ms
^C
--- baidu.com ping statistics ---
4 packets transmitted, 4 received, 0% packet loss, time 3004ms
rtt min/avg/max/mdev = 32.727/34.263/38.202/2.291 ms

可能原因2: CentOS 已经停止维护的问题。2020 年 12 月 8 号,CentOS 官方宣布了停止维护 CentOS Linux 的计划,并推出了 CentOS Stream 项目,CentOS Linux 8 作为 RHEL 8 的复刻版本,生命周期缩短,于 2021 年 12 月 31 日停止更新并停止维护(EOL),更多的信息可以查看 CentOS 官方公告。如果需要更新 CentOS,需要将镜像从 mirror.centos.org 更改为 vault.centos.org

解决

1.进入到 yum 的 repos 目录

cd /etc/yum.repos.d/

2.修改文件内容

sed -i 's/mirrorlist/#mirrorlist/g' /etc/yum.repos.d/CentOS-*
sed -i 's|#baseurl=http://mirror.centos.org|baseurl=http://vault.centos.org|g' /etc/yum.repos.d/CentOS-*

3.生成缓存更新

yum makecache

4.更新yum

yum update -y

最后就可以重新安装net-tools了

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
Hello! I'm C知道, a ChatGPT-based AI developed by CSDN. I'm here to help you with your question. Regarding the error message "Failed to download metadata for repo AppStream," it typically occurs when your system is unable to fetch the metadata for the AppStream repository. This repository contains metadata about available packages and their dependencies. To resolve this issue, you can try the following steps: 1. Check your internet connection: Ensure that you have a stable internet connection to download the metadata. You can try accessing other websites or performing a ping test to verify your connection. 2. Clear the cache: Sometimes, the metadata files might be corrupted or outdated. Clearing the cache may help resolve the issue. You can do this by running the following command: ``` sudo dnf clean all ``` 3. Refresh the repository metadata: Update the repository metadata by running the following command: ``` sudo dnf makecache ``` 4. Disable the specific repository: If the issue persists, you can try disabling the AppStream repository temporarily and see if it resolves the problem. To disable the repository, open the YUM or DNF configuration file (usually located in `/etc/yum.repos.d/`) and set `enabled=0` for the AppStream repository. 5. Check your mirror configuration: If you're using a mirror for package downloads, ensure that it is correctly configured and working. You can try switching to a different mirror or using the default repositories. If none of these steps work, please provide more details about your system, such as the Linux distribution and version you're using, any recent changes or updates made to your system, and any other relevant error messages you encounter. This information will help in troubleshooting the issue further.

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值