Centos 8 上的 Yum - 无法下载 repo 'AppStream' 的元数据

Centos 8 上的 Yum - 无法下载 repo 'AppStream' 的元数据

我在全新安装的 Centos 8 上,并首次尝试使用 yum(在这台机器上)。每次尝试安装或更新任何内容时,我都会收到以下信息:

yum update
CentOS-8 - AppStream                            0.0  B/s |   0  B     00:00    
Failed to download metadata for repo 'AppStream'
Error: Failed to download metadata for repo 'AppStream'

端口 80 是打开的,尽管 nmap 报告它已关闭,大概是因为我还没有安装 apache。为了确保万无一失,我已将端口 80 添加到了防火墙,这已得到确认:

firewall-cmd --list-ports
25/tcp 80/tcp

我尝试了各种建议,例如 yum clean 和清除 yum 缓存,但没有任何帮助。

dnf.log 中的内容如下:

2020-03-30T19:33:01Z INFO --- logging initialized ---
2020-03-30T19:33:01Z DDEBUG timer: config: 4 ms
2020-03-30T19:33:01Z DEBUG Loaded plugins: builddep, changelog, config-manager, copr, debug, debuginfo-install, download, generate_completion_cache, needs-restarting, playground, repoclosure, repodiff, repograph, repomanage, reposync
2020-03-30T19:33:01Z DEBUG DNF version: 4.2.7
2020-03-30T19:33:01Z DDEBUG Command: yum install httpd 
2020-03-30T19:33:01Z DDEBUG Installroot: /
2020-03-30T19:33:01Z DDEBUG Releasever: 8
2020-03-30T19:33:01Z DEBUG cachedir: /var/cache/dnf
2020-03-30T19:33:01Z DDEBUG Base command: install
2020-03-30T19:33:01Z DDEBUG Extra commands: ['install', 'httpd']
2020-03-30T19:33:01Z DEBUG repo: downloading from remote: AppStream
2020-03-30T19:33:02Z DEBUG error: Curl error (6): Couldn't resolve host name for http://mirrorlist.centos.org/?release=8&arch=x86_64&repo=AppStream&infra=stock [Could not resolve host: mirrorlist.centos.org] (http://mirrorlist.centos.org/?release=8&arch=x86_64&repo=AppStream&infra=stock).
2020-03-30T19:33:02Z DEBUG Cannot download 'http://mirrorlist.centos.org/?release=8&arch=x86_64&repo=AppStream&infra=stock': Cannot prepare internal mirrorlist: Curl error (6): Couldn't resolve host name for http://mirrorlist.centos.org/?release=8&arch=x86_64&repo=AppStream&infra=stock [Could not resolve host: mirrorlist.centos.org].
2020-03-30T19:33:02Z ERROR Failed to download metadata for repo 'AppStream'
2020-03-30T19:33:02Z DDEBUG Cleaning up.
2020-03-30T19:33:02Z SUBDEBUG 
Traceback (most recent call last):
  File "/usr/lib/python3.6/site-packages/dnf/repo.py", line 552, in load
    ret = self._repo.load()
  File "/usr/lib64/python3.6/site-packages/libdnf/repo.py", line 394, in load
    return _repo.Repo_load(self)
RuntimeError: Failed to download metadata for repo 'AppStream'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/lib/python3.6/site-packages/dnf/cli/main.py", line 65, in main
    return _main(base, args, cli_class, option_parser_class)
  File "/usr/lib/python3.6/site-packages/dnf/cli/main.py", line 98, in _main
    return cli_run(cli, base)
  File "/usr/lib/python3.6/site-packages/dnf/cli/main.py", line 114, in cli_run
    cli.run()
  File "/usr/lib/python3.6/site-packages/dnf/cli/cli.py", line 1134, in run
    self._process_demands()
  File "/usr/lib/python3.6/site-packages/dnf/cli/cli.py", line 832, in _process_demands
    load_available_repos=self.demands.available_repos)
  File "/usr/lib/python3.6/site-packages/dnf/base.py", line 406, in fill_sack
    self._add_repo_to_sack(r)
  File "/usr/lib/python3.6/site-packages/dnf/base.py", line 136, in _add_repo_to_sack
    repo.load()
  File "/usr/lib/python3.6/site-packages/dnf/repo.py", line 558, in load
    raise dnf.exceptions.RepoError(str(e))
dnf.exceptions.RepoError: Failed to download metadata for repo 'AppStream'
2020-03-30T19:33:02Z CRITICAL Error: Failed to download metadata for repo 'AppStream'

答案1

显然这不是问题所在,但如果你有固定您将自己升级到 CentOS 8.1.1911,您将得到同样的错误,直到您将 /etc/yum.repos.d/ 存储库重新指向http://vault.centos.org代替http://mirror.centos.org

答案2

您需要连接到互联网才能下载软件包。

检查您是否有 IP 地址(使用ip a)、是否有默认路由(使用ip r)以及是否定义了名称服务器,以便可以解析名称(使用cat /etc/resolv.conf)。

答案3

以真主的名义。我认为这个问题的原因是 CentOS 版本的生命终结。

CentOS Linux 7 EOL: 2024-06-30
CentOS Linux 8 EOL: 2021-12-31
CentOS Stream 8 EOL: 2024-05-31
CentOS Stream 9 EOL: estimated 2027, dependent on RHEL9 end of “Full Support Phase”

所以我从 CentOS Linux 8 迁移到 CentOS Stream。

注意你的服务器必须是最新的。在操作环境中,它与风险相关。

#dnf 安装 centos-release-stream

#dnf 交换 centos-{linux,stream}-repos

#dnf 发行版同步

说明位于以下网址: https://www.tecmint.com/migrate-centos-8-to-centos-stream/

答案4

在我从软件存储库中签出并禁用一些错误签入的存储库后,问题在 centos stream 8 的全新安装中得到解决。

下面的图片 来自软件存储库

列表第1,2,3页3

相关内容