YumRepo Error: All mirror URLs are not using ftp, http[s] or file.


Today, a Linux (CentOS 6.5) virtual machine was installed on VMware. When installing apache http web server, the following problems occurred:

Without saying a word, I searched a large circle on the Internet and combined with various solutions of netizens. Here, I summarize.

terms of settlement

1. Ensure that the virtual machine network is connected

First, ensure that the virtual machine network is connected. You can ping www.baidu.com.
If not, set the network card DNS domain name resolution server.

DNS1= #Note: is the DNS provided by google. The address is universal. Relatively speaking, it is more suitable for foreign countries and users visiting foreign websites.
DNS2= #Note: is a DNS commonly used by China Mobile, China Telecom and China Unicom. Both mobile phones and computers can be used. It is clean without advertising. The resolution success rate is relatively higher. Domestic users use it more, and the speed is relatively fast and stable. It is a DNS commonly used by domestic users to surf the Internet

Then vi /etc/resolv.conf, where the nameserver corresponds to the DNS configuration in the network card configuration.


Test again that the network is connected.

Continue yum install httpd -y, the problem still exists.

2. Configure repo file

Some netizens described that there was a problem with the configuration of / etc/yum.repos.d/CentOS-Base.repo. Comment out the mirrorlist configuration item and release the baseurl configuration item. After a try, an error was reported, but the error information was different from the previous one.

report errors: http://mirror.centos.org/centos/6/os/x86_64/repodata/repomd.xml: [Errno 14] PYCURL ERROR 22 - "The requested URL returned error: 404 Not Found", it should be that the link in the configuration cannot be accessed. Try to access this address in the browser, and you can only access it http://mirror.centos.org/centos/6 , the following content has been deleted from CentOS official website.

Solution: change the source site configuration to the domestic Tsinghua University site:


Ensure that the Tsinghua University site has access to:

Modify yum source site configuration:
Rename all repo files in / etc/yum.repos.d directory to *. Repo first_ Bak, and then create the CentOS-tsinghua.repo file. Its contents are modified as follows after comparing with the directory in the mirror station of Tsinghua University:

name=CentOS-6.5 - Base

#released updates 
name=CentOS-6.5 - Updates

#additional packages that may be useful
name=CentOS-6.5 - Extras

#additional packages that extend functionality of existing packages
name=CentOS-6.5 - Plus

#contrib - packages by Centos Users
name=CentOS-6.5 - Contrib

yum install httpd -y again, or an error is reported. But the error message is: [Errno 14] Peer cert cannot be verified or peer cert invalid

Reason: the ca certificate of yum server is not recognized.

Solution: in the / etc/yum.conf file, add the following line.


yum install httpd -y again to completely solve the problem.


Variables in the original repo file
How do I get these values?

These are not shell variables, so the result values cannot be printed in bash. These are the values provided by yum.

Releaser is the main version of CentOS. You can obtain it by using the following command:

rpm -q --qf='%{VERSION}\n' centos-release

basearch is the operating system architecture, which can be obtained by using the following command:

uname -m

Tags: Linux CentOS

Posted on Thu, 21 Oct 2021 03:55:42 -0400 by dave_55