2020-11-30 でサポート終了した CentOS 6 にて、YumRepo Error: All mirror URLs are not using ftp, http[s] or file が発生する件(解決済み)


はじめに

つい先日(2020-11-30)に、CentOS 6のサポートが終了しました。

https://wiki.centos.org/About/Product

これにより、yum installyum updateが以下のようなエラーを出力して失敗します。

Loaded plugins: fastestmirror, ovl
Setting up Install Process
Error: Cannot retrieve repository metadata (repomd.xml) for repository: base. Please verify its path and try again
YumRepo Error: All mirror URLs are not using ftp, http[s] or file.
Eg. Invalid release/repo/arch combination/
removing mirrorlist with no valid mirrors: /var/cache/yum/x86_64/6/base/mirrorlist.txt

とりあえずの回避策

Redditで以下の記事を見つけて試したところ、エラーは解消できたので、たぶん大丈夫かと。
https://www.reddit.com/r/sysadmin/comments/k63mcw/centos_repositories_down/

Yeah it's the EOL mentioned. To fix you can update your .repo files like:

Comment this out: mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=os

Add this instead: baseurl=http://vault.centos.org/centos/$releasever/os/$basearch/

  • mirrorlist=http://mirrorlist.centos.org/?をコメントアウトして
  • かわりに、baseurl=http://vault.centos.org/centos/$releasever/os/$basearch/を追加する

baseurl=http://vault.centos.org/centos/$releasever/os/$basearch//os/の部分がバリエーションあるので、以下のように、sedコマンドで書き換えてしまうと楽です。

$ sed -i -e "s/^mirrorlist=http:\/\/mirrorlist.centos.org/#mirrorlist=http:\/\/mirrorlist.centos.org/g" /etc/yum.repos.d/CentOS-Base.repo
$ sed -i -e "s/^#baseurl=http:\/\/mirror.centos.org/baseurl=http:\/\/vault.centos.org/g" /etc/yum.repos.d/CentOS-Base.repo

書き換え後のCentOS-Base.repoは以下のようになりました。

# CentOS-Base.repo
#
# The mirror system uses the connecting IP address of the client and the
# update status of each mirror to pick mirrors that are updated to and
# geographically close to the client.  You should use this for CentOS updates
# unless you are manually picking other mirrors.
#
# If the mirrorlist= does not work for you, as a fall back you can try the 
# remarked out baseurl= line instead.
#
#

[base]
name=CentOS-$releasever - Base
#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=os&infra=$infra
baseurl=http://vault.centos.org/centos/$releasever/os/$basearch/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6

#released updates 
[updates]
name=CentOS-$releasever - Updates
#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=updates&infra=$infra
baseurl=http://vault.centos.org/centos/$releasever/updates/$basearch/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6

#additional packages that may be useful
[extras]
name=CentOS-$releasever - Extras
#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=extras&infra=$infra
baseurl=http://vault.centos.org/centos/$releasever/extras/$basearch/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6

#additional packages that extend functionality of existing packages
[centosplus]
name=CentOS-$releasever - Plus
#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=centosplus&infra=$infra
baseurl=http://vault.centos.org/centos/$releasever/centosplus/$basearch/
gpgcheck=1
enabled=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6

#contrib - packages by Centos Users
[contrib]
name=CentOS-$releasever - Contrib
#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=contrib&infra=$infra
baseurl=http://vault.centos.org/centos/$releasever/contrib/$basearch/
gpgcheck=1
enabled=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6

おわりに

つい先日まで、問題なかったので、「もしやサポート切れか?」と疑って、調べたら予感的中しました。
ソフトウェアの寿命って短いですね。

ではでは。

関連リンク