centos – Paolo Redaelli https://monodes.com/predaelli A civil engineer with a longlife fondness for Software Libero Wed, 27 Apr 2022 07:57:09 +0000 en-US hourly 1 https://wordpress.org/?v=6.7.2 91795679 Progressively un-centoing https://monodes.com/predaelli/2022/04/27/progressively-un-centoing/ https://monodes.com/predaelli/2022/04/27/progressively-un-centoing/#respond Wed, 27 Apr 2022 15:47:00 +0000 https://monodes.com/predaelli/?p=9307 I got slightly annoyed when Centos were terminated. In my efforts to Fedorize the server I use everyday to host the WordPress blog that records most of the work done on our Quality Managament System I encountered this annoying error

Failed to download metadata for repo ‘appstream’: Cannot prepare internal mirrorlist: No URLs in mirrorlist – Centos 8

luckily Habibur Rhoman Joy from namespaceit.com provided an easy solution on his blog.

Habibur Rhoman Joy
FROM centos:8<br data-rich-text-line-break="true" /><br data-rich-text-line-break="true" />RUN sed -i 's/mirrorlist/#mirrorlist/g' /etc/yum.repos.d/CentOS-Linux-* &&\<br data-rich-text-line-break="true" />    sed -i 's|#baseurl=http://mirror.centos.org|baseurl=http://vault.centos.org|g' /etc/yum.repos.d/CentOS-Linux-*<br data-rich-text-line-break="true" /><br data-rich-text-line-break="true" />#docker<br data-rich-text-line-break="true" />RUN yum upgrade -y<br data-rich-text-line-break="true" /><br data-rich-text-line-break="true" />#other commands<br data-rich-text-line-break="true" />

 

On Centos 8, I have run “sudo yum update” but getting this error – 

Error: Failed to download metadata for repo 'appstream': Cannot prepare internal mirrorlist: No URLs in mirrorlist

Here I have given different solution for different situation.

Solution 1:

This error we are getting cause CentOS 8 became EOL at the end of 2021. Better if you migrate to CentOS Stream 8, CentOS 9 or Rocky Linux.

To solve current os you can run these commands –

sed -i 's/mirrorlist/#mirrorlist/g' /etc/yum.repos.d/CentOS-Linux-*

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

If you run these commands then dnf will work, but you will not get any updates.

If you want you can also upgrade to centos 8 stream:

 sudo dnf install centos-release-stream -y
 sudo dnf swap centos-{linux,stream}-repos -y
 sudo dnf distro-sync -y

 

Solution 2:

If you are using docker, you may face same type of problem. Hope this commands will help you –

FROM centos:8

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

#docker
RUN yum upgrade -y

#other commands
]]>
https://monodes.com/predaelli/2022/04/27/progressively-un-centoing/feed/ 0 9307