CentOS 6 操作系統版本結束了生命週期(EOL),Linux社區已不再維護該操作系統版本。建議您升級操作系統至CentOS 7及以上,如果您的業務過渡期仍需要使用CentOS 6系統中的一些安裝包,請根據下文切換CentOS 6的源。
背景信息
2020年11月30日CentOS 6 EOL。按照社區規則,CentOS 6的源地址http://mirror.centos.org/centos-6/內容已移除,目前第三方的鏡像站中均已移除CentOS 6的源。阿里雲的源http://mirrors.cloud.aliyuncs.com和http://mirrors.aliyun.com也無法同步到CentOS 6的源。
當您在使用默認配置的CentOS 6的源會發生報錯。報錯示例如下圖所示:
## https://www.cnblogs.com/liucx/
解決方法:
CentOS-Base源
cat > /etc/yum.repos.d/CentOS-Base.repo <<EOF [base] name=CentOS-6.10 enabled=1 failovermethod=priority baseurl=http://mirrors.aliyun.com/centos-vault/6.10/os/$basearch/ gpgcheck=1 gpgkey=http://mirrors.aliyun.com/centos-vault/RPM-GPG-KEY-CentOS-6 [updates] name=CentOS-6.10 enabled=1 failovermethod=priority baseurl=http://mirrors.aliyun.com/centos-vault/6.10/updates/$basearch/ gpgcheck=1 gpgkey=http://mirrors.aliyun.comm/centos-vault/RPM-GPG-KEY-CentOS-6 [extras] name=CentOS-6.10 enabled=1 failovermethod=priority baseurl=http://mirrors.aliyun.com/centos-vault/6.10/extras/$basearch/ gpgcheck=1 gpgkey=http://mirrors.aliyun.com/centos-vault/RPM-GPG-KEY-CentOS-6 [epel] name=Extra Packages for Enterprise Linux 6 - $basearch enabled=1 failovermethod=priority baseurl=http://mirrors.aliyun.com/epel-archive/6/$basearch gpgcheck=0 gpgkey=http://mirrors.aliyun.com/epel-archive/RPM-GPG-KEY-EPEL-6 EOF
epel源
cat > /etc/yum.repos.d/epel.repo <<EOF [epel] name=Extra Packages for Enterprise Linux 6 - $basearch enabled=1 failovermethod=priority baseurl=http://mirrors.aliyuncs.com/epel-archive/6/$basearch gpgcheck=0 gpgkey=http://mirrors.aliyuncs.com/epel-archive/RPM-GPG-KEY-EPEL-6 EOF
運行以下命令生成緩存
yum clean all yum makecache
參考:https://help.aliyun.com/document_detail/193569.htm