CentOS 6 docker yum更新

在centos 7環境下跑centos 6 docker image

docker run -it centos:6

下 yum update 報錯,顯示無法retrieve repomd.xml

確認一下原因,主要是因為 centos 6在2020 Nov就停止支援了,參考https://forums.centos.org/viewtopic.php?t=72710

Red Hat have pulled the plug on RHEL 6.x as of Nov 30th 2020 and as a result CentOS 6 is now a dead version. The online yum repos for CentOS 6 have been archived to vault.centos.org and there will be no more updates to it at all, ever.

yum repo archive到 vault.centos.org ,所以須將yum相關config修改,直接修改/etc/yum.repos.d/CentOS-Base.repo

將所有mirrorlist註解掉,改成baseurl指向vault.centos.org 就可以了

內容類似在/etc/yum.repos.d的CentOS-Vault.repo

不過 CentOS-Vault.repo 主要是archive packages obsoleted by current release,所以以CentOS 6.10來說 它裡面只包含到CentOS 6.9 repo

如果是內部要長期維護的話,最好還是建一個local yum repo mirror,避免網路上的archive repo失效

This entry was posted in System Administration. Bookmark the permalink.

Leave a Reply