Causes of errors when executing yum, and how yum works in the first place.


Publication date:December 27, 2020



INFOMARTION > Causes of errors when executing yum, and how yum works in the first place.

summary

For those who have trouble with yum, here is an explanation of how yum works in the first place. If it does not work well, you may see "Could not retrieve mirrorlist http://mirrorlist.centos.org/?・・・" or "curl#6 - "Could not resolve host: mirrorlist.centos.org;". In conclusion, there is a high possibility that your DNS settings or network settings are not well configured, and I would like to explain how to deal with this issue while explaining how yum works.

Table of Contents

  1. What is yum?
  2. Causes yum not to work well
  3. summary

1. What is yum?

I think you are usually installing various things by executing "yum install httpd" and so on.In a nutshell, yum is a package management tool. As you have somehow noticed, yum gets its files from the internet.

1-1. How yum works

A rough explanation of the process works as follows.

・Select destination server from yum repository information of own server

・Acquire data from the destination server

The repository information of the destination repository is stored under "/etc/yum.repos.d/". Data is acquired based on this information.

You will find the following information under "/etc/yum.repos.d/".

[base]
name=CentOS-$releasever - Base
mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=os&infra=$infra
#baseurl=http://mirror.centos.org/centos/$releasever/os/$basearch/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7

The above "mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=os&infra=$infra" is where to get it. Since "$releasever", "$basearch", and "$infra" are variables, the actual URL is "http://mirrorlist.centos.org/?release=7&arch=x86_64&repo=os&infra=" for my environment.

Accessing this URL in a browser or whatever will return the following information.

http://ftp.riken.jp/Linux/centos/7.9.2009/os/x86_64/
http://ftp.nara.wide.ad.jp/pub/Linux/centos/7.9.2009/os/x86_64/
http://ftp.jaist.ac.jp/pub/Linux/CentOS/7.9.2009/os/x86_64/
http://mirrors.cat.net/centos/7.9.2009/os/x86_64/
http://ftp.iij.ad.jp/pub/linux/centos/7.9.2009/os/x86_64/
http://ftp.yz.yamagata-u.ac.jp/pub/linux/centos/7.9.2009/os/x86_64/
http://ty1.mirror.newmediaexpress.com/centos/7.9.2009/os/x86_64/
http://ftp-srv2.kddilabs.jp/Linux/packages/CentOS/7.9.2009/os/x86_64/
http://mirror.vastspace.net/centos/7.9.2009/os/x86_64/
http://mirror.nus.edu.sg/centos/7.9.2009/os/x86_64/

The software package file (RPM file) is obtained from the above URL.

2. Causes yum not to work well

We would like to consider the cause of the non-working based on the mechanism of yum.

2-1. Cause 1: Not connected to the network.

As explained earlier, yum goes to an external server to retrieve software package files (RPM files). Therefore, yum cannot be executed if there is no internet connection.

"ping 8.8.8.8.8" (8.8.8.8.8 is Google's DNS server). and see if you get a response. If there is no response, it is most likely due to a lack of internet connection.

2-2. Cause 2: DNS is not configured.

yum goes to an external server to obtain software package files (RPM files), but instead of typing the IP address directly, it uses "http://mirrorlist.centos.org/?release=7&arch=x86_64&repo=os&infra =" and so on. Therefore, if the name resolution (IP address associated with) of "mirrorlist.centos.org" is not known, yum will fail.

Run "ping google.com" or similar to see if there is a response. If there is no response, it is most likely that the DNS settings are not well configured.

2-3. Cause 3: No repository information in own server

As explained in the mechanism of yum, yum looks at the repository information of its own server to find a place to acquire the information. If you are connected to the Internet and have DNS settings, it is highly likely that the settings under "/etc/yum.repos.d/" are incorrect.

For reference, it will not work without the following base settings.

[base]
name=CentOS-$releasever - Base
mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=os&infra=$infra
#baseurl=http://mirror.centos.org/centos/$releasever/os/$basearch/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7

3. summary

We have described how to deal with the case when yum does not work well when executed.

In my case, I was not connected due to poor DNS name resolution. I hope this will be helpful to others who are having trouble.

Thank you for taking the time to read this to the end.




■INFORMATION

Please click here to go to the top page of INFORMATION.


■PROFILE

Please click here to view the profile.


■For inquiries, please contact

For inquiries about the article, please contact us here.