欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

CentOS 6 Yum/EPEL源报错 “404 Not Found“

程序员文章站 2022-05-29 12:10:55
...

CentOS 6 Yum/EPEL源报错 “404 Not Found”

现CentOS 6操作系统所设置的Yum源为国内阿里云Yum源仓库,在yum安装时报错如下

~]# yum install rpm_package_name
Loaded plugins: fastestmirror
Determining fastest mirrors
 * base: mirrors.aliyun.com
 * extras: mirrors.aliyun.com
 * updates: mirrors.aliyun.com
http://mirrors.aliyun.com/centos/6/os/x86_64/repodata/repomd.xml: [Errno 14] 
PYCURL ERROR 22 - "The requested URL returned error: 404 Not Found"

因CentOS 6 版本生命周期在2020年11月30号终止,见文末链接[1]1,CentOS Yum上游源仅保留CentOS6 中6.10的分发Yum源,其他CentOS 6版本分支的源移至http://vault.centos.org/下。
国内的镜像源同步CentOS Yum源,大部分国内Yum镜像源已不可用

解决方法:

Yum 源

将 /etc/yum.repos.d/CentOS-Base.repo文件备份
mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.backup

根据当前CentOS6操作系统具体版本号,自行替换下列内容的版本号
如下为将CentOS Yum源为CentOS 6.10
vi /etc/yum.repos.d/CentOS-Base.repo
将 下列内容复制粘贴到CentOS-Base.repo

[base]
name=CentOS-6.10 - Base - vault.centos.org
failovermethod=priority
baseurl=http://vault.centos.org/6.10/os/$basearch/
gpgcheck=1
gpgkey=http://vault.centos.org/RPM-GPG-KEY-CentOS-6
 
#released updates 
[updates]
name=CentOS-6.10 - Updates - vault.centos.org
failovermethod=priority
baseurl=http://vault.centos.org/6.10/updates/$basearch/
gpgcheck=1
gpgkey=http://vault.centos.org/RPM-GPG-KEY-CentOS-6
 
#additional packages that may be useful
[extras]
name=CentOS-6.10 - Extras - vault.centos.org
failovermethod=priority
baseurl=http://vault.centos.org/6.10/extras/$basearch/
gpgcheck=1
gpgkey=http://vault.centos.org/RPM-GPG-KEY-CentOS-6
 
#additional packages that extend functionality of existing packages
[centosplus]
name=CentOS-6.10 - Plus - vault.centos.org
failovermethod=priority
baseurl=http://vault.centos.org/6.10/centosplus/$basearch/
gpgcheck=1
enabled=0
gpgkey=http://vault.centos.org/RPM-GPG-KEY-CentOS-6
 
#contrib - packages by Centos Users
[contrib]
name=CentOS-6.10 - Contrib - vault.centos.org
failovermethod=priority
baseurl=http://vault.centos.org/6.10/contrib/$basearch/
gpgcheck=1
enabled=0
gpgkey=http://vault.centos.org/RPM-GPG-KEY-CentOS-6

如要更换为其它分支版本号,other_vers 指代所要指定的版本号值
sed -i.bak ‘s/6.10/other_vers/g’ /etc/yum.repos.d/CentOS-Base.repo

yum 验证操作
yum clean all #清除缓存
yum makecache #创建缓存
yum repolist #查看源仓库情况

epel源

同样的EPEL6源 声明终止维护,见文末链接[2]2.
如在用EPEL源执行软件包安装报错"404 Not Found",同样重命名epel.repo文件,新建epel.repo, 将以下内容复制

[epel]
name=Extra Packages for Enterprise Linux 6 - $basearch
baseurl=https://archives.fedoraproject.org/pub/archive/epel/6/$basearch
failovermethod=priority
enabled=1
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-6

[epel-debuginfo]
name=Extra Packages for Enterprise Linux 6 - $basearch - Debug
baseurl=https://archives.fedoraproject.org/pub/archive/epel/6/$basearch/debug
failovermethod=priority
enabled=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-6
gpgcheck=1

[epel-source]
name=Extra Packages for Enterprise Linux 6 - $basearch - Source
baseurl=https://archives.fedoraproject.org/pub/archive/epel/6/SRPMS
failovermethod=priority
enabled=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-6
gpgcheck=1

  1. [1]: https://wiki.centos.org/FAQ/General CentOS EOL FAQ 19 ↩︎

  2. [2]: https://lists.fedoraproject.org/archives/list/[email protected]/thread/NA2AC4LXAMLB5ASYVS6DCVM3UEHK4LQ6/ epel6 EOL ↩︎