现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”
因CentOS6版本在2020年11月30号版本生命周期终止,CentOS Yum上游源仅保留CentOS6中6.10的分发Yum源,其他CentOS 6版本分支的源移至http://vault.centos.org/下。
国内的镜像源同步CentOS Yum源,导致国内Yum镜像源已不可用
解决方法:
1.备份 /etc/yum.repos.d/CentOS-Base.repo文件
mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.backup
- 设置CentOS Yum源为CentOS6.10
新建文件/etc/yum.repos.d/CentOS-Base.repo,将以下内容复制进去
vi /etc/yum.repos.d/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
-------------------------------------------结束-------------------------------------------------------
3.YUM操作验证
yum clean all #清除缓存
yum makecache #创建缓存
yum repolist #查看源仓库情况
附加阿里云YUM与EPEL源
https://mirrors.aliyun.com/centos-vault/6.x/
https://mirrors.aliyun.com/epel-archive/6/