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

problem Today, a Linux (CentOS 6.5) virtual machine was installed on VMware. When installing apache http web server, the...
1. Ensure that the virtual machine network is connected
2. Configure repo file

problem

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=8.8.8.8 #Note: 8.8.8.8 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=114.114.114.114 #Note: 114.114.114.114 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.

nameserver 8.8.8.8 nameserver 114.114.114.114

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:

https://mirrors.tuna.tsinghua.edu.cn/centos-vault

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:

[base] name=CentOS-6.5 - Base baseurl=https://mirrors.tuna.tsinghua.edu.cn/centos-vault/6.5/os/x86_64/ gpgcheck=1 gpgkey=https://mirrors.tuna.tsinghua.edu.cn/centos-vault/6.5/os/x86_64/RPM-GPG-KEY-CentOS-6 #released updates [updates] name=CentOS-6.5 - Updates baseurl=https://mirrors.tuna.tsinghua.edu.cn/centos-vault/6.5/updates/x86_64/ gpgcheck=1 gpgkey=https://mirrors.tuna.tsinghua.edu.cn/centos-vault/6.5/os/x86_64/RPM-GPG-KEY-CentOS-6 #additional packages that may be useful [extras] name=CentOS-6.5 - Extras baseurl=https://mirrors.tuna.tsinghua.edu.cn/centos-vault/6.5/extras/x86_64/ gpgcheck=1 gpgkey=https://mirrors.tuna.tsinghua.edu.cn/centos-vault/6.5/os/x86_64/RPM-GPG-KEY-CentOS-6 #additional packages that extend functionality of existing packages [centosplus] name=CentOS-6.5 - Plus baseurl=https://mirrors.tuna.tsinghua.edu.cn/centos-vault/6.5/centosplus/x86_64/ gpgcheck=1 enabled=0 gpgkey=https://mirrors.tuna.tsinghua.edu.cn/centos-vault/6.5/os/x86_64/RPM-GPG-KEY-CentOS-6 #contrib - packages by Centos Users [contrib] name=CentOS-6.5 - Contrib baseurl=https://mirrors.tuna.tsinghua.edu.cn/centos-vault/6.5/contrib/x86_64/ gpgcheck=1 enabled=0 gpgkey=https://mirrors.tuna.tsinghua.edu.cn/centos-vault/6.5/os/x86_64/RPM-GPG-KEY-CentOS-6

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.

sslverify=false

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

Supplement:

Variables in the original repo file
$releasever
$basearch
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='%\n' centos-release

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

uname -m

21 October 2021, 03:55 | Views: 4718

Add new comment

For adding a comment, please log in
or create account

0 comments