CentOS 6.9 yum 404 "The requested URL returned error: 404 Not Found"“

CentOS 6.9. When executing yum makecache, 404 errors are reported as follows:

http://mirrors.cloud.aliyuncs.com/epel/6/x86_64/repodata/repomd.xml: [Errno 14] PYCURL ERROR 22 - "The requested URL returned error: 404 Not Found"
The reason is that "CentOS 6 has entered EOL (Reaches End of Life) with the end of November 2020 , the official removed the software source related to CentOS 6 from the official source on December 2, and then the level-by-level image will be deleted one after another. Although CentOS has been released to version 8, there are still some old systems using CentOS6, and the image of the software source of each version is still retained, but the software source will not be updated and the address has changed“

If you need to reconfigure the yum source, you can refer to aliyun, Netease 163 and the official Vault source. The official Vault source is used here:

1. Modify / etc / yum.com repos. D CentOs base The values of "name","baseurl" and "gpgkey" in the repo file. The name is based on your CentOs version. Here is 6.9. Please modify it according to your version.

To view the CentOs version, use the following command:

cat /etc/redhat-release

[base]
name=CentOS-6.9 - Base - vault.centos.org
enabled=1
failovermethod=priority
baseurl=http://vault.centos.org/6.9/os/$basearch/
gpgcheck=1
gpgkey=http://vault.centos.org/RPM-GPG-KEY-CentOS-6

[updates]
name=CentOS-6.9 - Updates - vault.centos.org
enabled=1
failovermethod=priority
baseurl=http://vault.centos.org/6.9/updates/$basearch/
gpgcheck=1
gpgkey=http://vault.centos.org/RPM-GPG-KEY-CentOS-6

[extras]
name=CentOS-6.9 - Extras - vault.centos.org
enabled=1
failovermethod=priority
baseurl=http://vault.centos.org/6.9/extras/$basearch/
gpgcheck=1
gpgkey=http://vault.centos.org/RPM-GPG-KEY-CentOS-6

[centosplus]
name=CentOS-6.9 - Plus - vault.centos.org
failovermethod=priority
baseurl=http://vault.centos.org/6.9/centosplus/$basearch/
gpgcheck=1
enabled=0
gpgkey=http://vault.centos.org/RPM-GPG-KEY-CentOS-6
 
[contrib]
name=CentOS-6.9 - Contrib - vault.centos.org
failovermethod=priority
baseurl=http://vault.centos.org/6.9/contrib/$basearch/
gpgcheck=1
enabled=0
gpgkey=http://vault.centos.org/RPM-GPG-KEY-CentOS-6

Modify CentOS base Repo has two methods:

1) Via xftp( Xshell, Xftp official website, personal family Free Edition )Set CentOS base on the server Download the repo locally, modify it, and then upload it to the server to overwrite the previous file

2) Execute in xshell using command

Backup first:

cp /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.bak

Then edit the file with vi

vi /etc/yum.repos.d/CentOS-Base.repo

Use # i to enter the input mode (Insert), press the up, down, left and right keys to move, and finally after modification, click "esc" (return to the command mode) on the keyboard and enter the colon: wq in the last line to save and exit the vi editor (w is to save and q is to exit)

Then clear the Yum cache

yum clean all

Rebuild cache

yum makecache

 

2. At this time, most people can already create. If they still report an Error 404:

At this time, it is found that the error part still refers to the previous image source, so open Yun repos. D folder. It is found that the reference address in the epel file is still the previous default address, so it is also modified:

After modification, it can be created

Keywords: Linux CentOS yum

Added by ehhwan on Mon, 07 Mar 2022 23:29:48 +0200