LoginSignup
0
0

CentOS7のサーバでのリポジトリ停止対応

Posted at

CentOS7は2024 年 6 月 30 日にサポート終了 (EOL:End Of Life)になりました。
本来ならばOSバージョンへのアップグレードを行う必要がありますが、内部で使用しているサーバであり、アップグレードまでの間の対策として実施したことを記録しておきます。

出発点

サーバから管理者のメールアドレスに下記のメールが届いた。

タイトル:Anacron job 'cron.daily' on サーバ名
本文
etc/cron.daily/0yum-daily.cron:

Could not retrieve mirrorlist http://mirrorlist.centos.org/?release=7&arch=x86_64&repo=os&infra=stock error was
14: curl#6 - "Could not resolve host: mirrorlist.centos.org; Name or service not known"

この時yumのキャッシュをクリアしようとしたが、同様のエラーメッセージがコンソールに表示された。

$ sudo yum clean all
読み込んだプラグイン:fastestmirror, langpacks
リポジトリーを清掃しています: base centos-sclo-rh docker-ce-stable epel extras forensics
                            : forensics-splunk gitlab_gitlab-ce gitlab_gitlab-ce-source nux-dextop
                            : remi-php74 remi-safe sublime-text updates
Cleaning up list of fastest mirrors
Other repos take up 36 M of disk space (use --verbose for details)
[tuti@takejr ~]$ sudo yum makecache
読み込んだプラグイン:fastestmirror, langpacks
Determining fastest mirrors
Could not retrieve mirrorlist http://mirrorlist.centos.org?arch=x86_64&release=7&repo=sclo-rh error was
14: curl#6 - "Could not resolve host: mirrorlist.centos.org"

原因

mirrorlist.centos.org のリポジトリが利用不能となった

対応

CentOS Vault Mirrorを使うように、/etc/yum.repos.d/CentOS-Base.repoを変更する

vi /etc/yum.repos.d/CentOS-Base.repo

[base]
name=CentOS-$releasever - Base
baseurl=http://vault.centos.org/centos/$releasever/os/$basearch/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7
 
#released updates
[updates]
name=CentOS-$releasever - Updates
baseurl=http://vault.centos.org/centos/$releasever/updates/$basearch/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7
 
#additional packages that may be useful
[extras]
name=CentOS-$releasever - Extras
baseurl=http://vault.centos.org/centos/$releasever/extras/$basearch/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7
 
#additional packages that extend functionality of existing packages
[centosplus]
name=CentOS-$releasever - Plus
baseurl=http://vault.centos.org/centos/$releasever/centosplus/$basearch/
gpgcheck=1
enabled=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7

yumのキャッシュクリア

$ yum clean all

後始末

これでphpのバージョンアップなどの作業もできるが、できるだけ速やかにOSのアップグレードが必要です。
頑張りましょう!

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0