Workaround for “could not retrieve mirrorlist” during Yum installation

[ root@localhost ~]# yum -y install wget    ( Note: after downloading the WGet command and installing it)

Could not retrieve mirrorlist   http://mirrorlist.centos.org/?release=5&amp ; arch=i386& repo=os   error was
[Errno 4] IOError: < urlopen error (-3, ‘\xe5\x9f\x9f\xe5\x90\x8d\xe8\xa7\xa3\xe6\x9e\x90\xe6\x9a\x82\xe6\x97\xb6\xe5\xa4\xb1\xe8\xb4\xa5’)>
Error: Cannot retrieve repository metadata (repomd.xml) for repository: base. Please verify its path and try again

[ root@localhost ~]# yum install gcc-c++
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
Could not retrieve mirrorlist   http://mirrorlist.centos.org/?release=5&amp ; arch=x86_ 64& repo=addons   error was
[Errno 4] IOError: < urlopen error (-3, ‘Temporary failure in name resolution’)>
Error: Cannot find a valid baseurl for repo: addons

 

Whether you use the command above or below, the error will appear

Reason: resolv.conf is not configured

resolvent:

Configure resolv.conf in the/etc directory to join the nameserver IP, such as:

nameserver 8.8.8.8
nameserver 8.8.4.4
search localdomain

Save and run the above command again.

 

=================================

/Configure DNS clients in/etc/resolv.conf  

 

/Etc/resolv.conf configure DNS client
file/etc/resolv.conf configure DNS client, which contains the domain name search order of the host and the address of the DNS server. Each line should contain a keyword and one or more parameters separated by spaces
here is an example file:

nameserver 8.8.8.8
nameserver 8.8.4.4
search localdomain

The legal parameters and their meanings are as follows:
nameserver indicates the IP address of the DNS server. There can be many rows of nameservers, each with an IP address. When querying, follow the order of nameservers in this file, and only when the first nameserver does not respond, query the following nameserver.
domain declares the domain name of the host. Many programs use it, such as mail system; It is also used when DNS query is performed for the master
machine without domain name. If there is no domain name, the host name will be used and all content before the first dot (.) will be deleted
search its multiple parameters indicate the order of domain name query. When you want to query a host without a domain name, the host will search separately in the domain declared by search. Domain and search cannot coexist; If both exist, the following will be used
sortlist allows you to sort the domain name results. Its parameters are network/mask pairs. Allow any sort order. The default/E T C/r e s o l v. c o n f file is not available in red hat. Its contents are dynamically created according to the options given at installation time.

Similar Posts: