I'm on a fresh Centos 8 install and have tried to use yum for the first time (on this machine). I get the following for any attempt to install or update anything:
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'
Port 80 is open although nmap reports it as closed presumably because I haven't yet installed apache. To be double sure I have added port 80 to firewalld which is confirmed:
firewall-cmd --list-ports
25/tcp 80/tcp
I have tried various advice like yum clean and clearing the yum cache but nothing helps.
This is what is in the 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'
Apparently not the problem here, but if you have pinned yourself to CentOS 8.1.1911 you will get the same error until you re-point your /etc/yum.repos.d/ repositories at http://vault.centos.org instead of http://mirror.centos.org
You need to be connected to the Internet in order to download packages.
Check that you have an IP address (with
ip a
), that you have a default route (withip r
), and that you have nameservers defined so you can resolve names (withcat /etc/resolv.conf
).I got the same error message when installing PHP. It was caused by the network configuration: after changing the gateway address in /etc/sysconfig/network-scripts/ifcfg-enp2s0 the problem was solved. Probably caused by changing from DHCP to a static IP-Address. The information in my internet-router was misleading. I just used the first address in my LAN, in my case: 192.168.11.1. It is the address of the management-console of my router.
In the name of ALLAH. I think that This problem reseon is for End of Life of centos version..
So I Migrating from CentOS Linux 8 to CentOS Stream.
notice than your server must be fresh. In the operating environment it is associated with risk.
#dnf install centos-release-stream
#dnf swap centos-{linux,stream}-repos
#dnf distro-sync
instruction is in this url: https://www.tecmint.com/migrate-centos-8-to-centos-stream/
the problem solved in a clean new installation of centos stream 8 after I checked out and disabled from software repositories some repositories that checked in error.
Images below from software repositories
list 1st,2nd,3rd page3
Apparently, I faced a similar situation while updating my centos and installing a few packages.
Migrate from CentOS 8 to CentOS Stream 8:
It will help you resolve your issue.