现CentOS 6操作系统所设置的Yum源为国内阿里云Yum源仓库,在yum安装时报错如下
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号版本生命周期终止,CentOS Yum上游源已不保留CentOS 6 Yum源,涉及CentOS 6版本分支的Yum源移至http://vault.centos.org/下。
对应国内的镜像源站点访问过期源,如阿里云Yum源-https://mirrors.aliyun.com/centos-vault
解决方法:
1.备份 /etc/yum.repos.d/CentOS-Base.repo文件
mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.backup
2. 设置CentOS Yum源为CentOS 6.10
官方过期归档Yum源
http://vault.centos.org/6.10
可选国内镜像源
https://mirror.tuna.tsinghua.edu.cn/centos-vault/6.10
https://mirrors.aliyun.com/centos-vault/6.10
新建文件/etc/yum.repos.d/CentOS-Base.repo,将以下内容复制进去
vi /etc/yum.repos.d/CentOS-Base.repo
因国内镜像站点HTTPs涉及CentOS yum访问本地证书无法识别,修改为HTTP访问
-------------------------------------------复制以下内容-------------------------------------------------------
[base]
name=CentOS-6.10 - Base - vault.centos.org
failovermethod=priority
baseurl=http://mirror.tuna.tsinghua.edu.cn/centos-vault/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://mirror.tuna.tsinghua.edu.cn/centos-vault/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://mirror.tuna.tsinghua.edu.cn/centos-vault/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://mirror.tuna.tsinghua.edu.cn/centos-vault/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://mirror.tuna.tsinghua.edu.cn/centosvault/6.10/contrib/$basearch/
gpgcheck=1
enabled=0
gpgkey=http://vault.centos.org/RPM-GPG-KEY-CentOS-6
-------------------------------------------结束-------------------------------------------------------
3.YUM操作验证
yum clean all #清除缓存
yum makecache #创建缓存
yum repolist #查看源仓库情况
注:
阿里云 镜像站点CentOS 6 YUM与EPEL源
https://mirrors.aliyun.com/centos-vault/6.x/
https://mirrors.aliyun.com/epel-archive/6/