If you are using CentOS and get this error when trying to install a package, “Could not retrieve mirrorlist http:/mirrorlist.centos.org” means that the mirror “mirrorlist.centos.org” no longer exists. This is because on June 30, 2024 CentOS has reached its end of life.
Adding currents mirrors
To solve this problem and continue using the current mirrors we can replace them with these others by executing the following commands :
- In a CentOS machine:
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-*
- In a Dockerfile:
# Update the repository configuration to use the vault.centos.org mirror
RUN 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-*
Important
As the project is not ongoing use your CentOS systems only in test or lab environments.
More information about CentOS End Of Life
CentOS reached end of life (EOL) on June 30, 2024.
https://www.redhat.com/en/topics/linux/centos-linux-eol
https://www.redhat.com/en/blog/centos-linux-going-end-life-what-does-mean-me