When I tried to run dnf update or yum update commands on Rocky Linux 8.6 I got this errormessage: “Errors during downloading metadata for repository ‘appstream’: Curl error…”
or
“Failed to download metadata for repo ‘appstream’”
I tried to run dnf clean all but the error retained.
I found this article for similar error in CentOS:
https://techglimpse.com/failed-metadata-repo-appstream-centos-8/
I tried to adopt this solution and changed the link to Rocky repo.
Finally I used this solution below and it worked for me:
sed -i 's/mirrorlist/#mirrorlist/g' /etc/yum.repos.d/Rocky-*
sed -i 's|#baseurl=http://dl.rockylinux.org/$contentdir|baseurl=http://dl.rockylinux.org/vault/rocky|g' /etc/yum.repos.d/Rocky-*