Centos6yum源切換

CentOS 6操作系統(tǒng)版本結(jié)束了生命周期(EOL),Linux社區(qū)已不再維護(hù)該操作系統(tǒng)版本。建議您升級(jí)操作系統(tǒng)至CentOS 7及以上,如果您的業(yè)務(wù)過渡期仍需要使用CentOS 6系統(tǒng)中的一些安裝包,請(qǐng)根據(jù)下文切換CentOS 6的源。

背景信息

2020年11月30日CentOS 6 EOL。按照社區(qū)規(guī)則,CentOS 6的源地址http://mirror.centos.org/centos-6/內(nèi)容已移除,目前第三方的鏡像站中均已移除CentOS 6的源。阿里云的源http://mirrors.cloud.aliyuncs.comhttp://mirrors.aliyun.com也無法同步到CentOS 6的源。當(dāng)您在阿里云上繼續(xù)使用默認(rèn)配置的CentOS 6的源會(huì)發(fā)生報(bào)錯(cuò)。報(bào)錯(cuò)示例如下圖所示:

您可以通過下文的操作步驟,在CentOS 6操作系統(tǒng)的ECS實(shí)例中將源配置按照網(wǎng)絡(luò)環(huán)境不同進(jìn)行切換。

操作步驟

服務(wù)器編輯/etc/yum.repos.d/CentOS-Base.repo 文件。

[base]
name=CentOS-6.10
enabled=1
failovermethod=priority
baseurl=http://mirrors.cloud.aliyuncs.com/centos-vault/6.10/os/$basearch/
gpgcheck=1
gpgkey=http://mirrors.cloud.aliyuncs.com/centos-vault/RPM-GPG-KEY-CentOS-6

[updates]
name=CentOS-6.10
enabled=1
failovermethod=priority
baseurl=http://mirrors.cloud.aliyuncs.com/centos-vault/6.10/updates/$basearch/
gpgcheck=1
gpgkey=http://mirrors.cloud.aliyuncs.com/centos-vault/RPM-GPG-KEY-CentOS-6

[extras]
name=CentOS-6.10
enabled=1
failovermethod=priority
baseurl=http://mirrors.cloud.aliyuncs.com/centos-vault/6.10/extras/$basearch/
gpgcheck=1
gpgkey=http://mirrors.cloud.aliyuncs.com/centos-vault/RPM-GPG-KEY-CentOS-6

[epel]
name=Extra Packages for Enterprise Linux 6 - $basearch
enabled=1
failovermethod=priority
baseurl=http://mirrors.cloud.aliyuncs.com/epel-archive/6/$basearch
gpgcheck=0
gpgkey=http://mirrors.cloud.aliyuncs.com/epel-archive/RPM-GPG-KEY-EPEL-6

切換完成后,您可以使用yum install命令安裝需要的軟件包。

?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請(qǐng)聯(lián)系作者
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時(shí)請(qǐng)結(jié)合常識(shí)與多方信息審慎甄別。
平臺(tái)聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點(diǎn),簡書系信息發(fā)布平臺(tái),僅提供信息存儲(chǔ)服務(wù)。

相關(guān)閱讀更多精彩內(nèi)容

友情鏈接更多精彩內(nèi)容