クリエイター:メタボ兔

ウェブやアプリの開発者で利用する色な技術やサーバーや開発環境の設定について共有する場

CentOS6のサポート終了の対応(yum使用出来るように)

問題点

CentOS6のサポートが終了(2020-11-30)されたことでCentOSのバージョンアップをしてないサーバーのyumの使用が出来なくなりました。

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

f:id:FattyRabbit:20210105173132p:plain

# yum check-update
読み込んだプラグイン:fastestmirror, refresh-packagekit, security
Determining fastest mirrors
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
エラー: Cannot find a valid baseurl for repo: base

ところでサポートが終わってもモジュールの追加が必要などき何もインストール出来ないのは問題ですね。

対策

リポジトリのURLを書き換えることで対処する。

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

キャッシュをクリアする。

# yum clean all

出来るはずだと思いましたが、エラーが出ますね。

Cannot retrieve metalink for repository: epel. Please verify its path and try again

epel.repoが問題らしいです。

# sed -i "s/mirrorlist=https/mirrorlist=http/" /etc/yum.repos.d/epel.repo

キャッシュをクリアして使用します。

# yum clean all
# yum update