現(xiàn)CentOS 6操作系統(tǒng)所設(shè)置的Yum源為國內(nèi)阿里云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/下。
對應(yīng)國內(nèi)的鏡像源站點訪問過期源,如阿里云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. 設(shè)置CentOS Yum源為CentOS 6.10
官方過期歸檔Yum源
http://vault.centos.org/6.10
可選國內(nèi)鏡像源
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,將以下內(nèi)容復制進去
vi /etc/yum.repos.d/CentOS-Base.repo
因國內(nèi)鏡像站點HTTPs涉及CentOS yum訪問本地證書無法識別,修改為HTTP訪問
-------------------------------------------復制以下內(nèi)容-------------------------------------------------------
[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
-------------------------------------------結(jié)束-------------------------------------------------------
3.YUM操作驗證
yum clean all #清除緩存
yum makecache #創(chuàng)建緩存
yum repolist #查看源倉庫情況
注:
阿里云 鏡像站點CentOS 6 YUM與EPEL源
https://mirrors.aliyun.com/centos-vault/6.x/
https://mirrors.aliyun.com/epel-archive/6/