Could not resolve host: mirrorlist.centos.org for CentOS-7


Issues:

If you need to install something for your EOL CentOS-7. For example to install CentOS_lm_sensors

Could not retrieve mirrorlist http://mirrorlist.centos.org/?release=7&arch=x86_64&repo=os&infra=stock error was
14: curl#6 - "Could not resolve host: mirrorlist.centos.org; Unknown error"
http://mirror.centos.org/centos/7/os/x86_64/repodata/repomd.xml: [Errno 14] curl#6 - "Could not resolve host: mirror.centos.org; Unknown error"
Trying other mirror.

Solutions:

Create a directory and save the original repo files before editing

# cd /etc/yum.repos.d
# mkdir original_repos
# copy -v *.repo original_repos

You will need to update the repofiles to point to vault.centos.org

sed -i s/mirror.centos.org/vault.centos.org/g /etc/yum.repos.d/*.repo
sed -i s/^#.*baseurl=http/baseurl=http/g /etc/yum.repos.d/*.repo
sed -i s/^mirrorlist=http/#mirrorlist=http/g /etc/yum.repos.d/*.repo
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-*

Clean the old cache

# yum clean all

Let’s try installing lm_sensors using yum.

# yum install lm_sensors
# yum install lm_sensors-sensord
# sensors-detect
# watch -d sensors
# service sensord start

Leave a comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.