0
0

More than 1 year has passed since last update.

サポートが切れたCentOS6でyumを使う方法

Posted at

執筆時点の日付は2021/09/17です。
CentOS6でyumが使用できずググって参考サイトにたどり着きました。
CentOS6のサポートが切れていることでyumを実行できない状態でした。
サイトを参考にリポジトリ設定ファイルを修正した流れをメモします。
参考サイトだと設定ファイルが3つありましたが、自分の環境だと1つだけでした。

リポジトリファイル修正前に出ていたエラー

# yum list installed postfix
読み込んだプラグイン:fastestmirror
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

yumリポジトリファイルを編集

念の為、ファイルのバックアップを作成します。

# cd /etc/yum.repos.d/
# cp CentOS-Base.repo CentOS-Base.repo.org

編集手順

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

Base、Update、Extras、Plus、Contribそれぞれにおいて同じ箇所を修正します。
主な修正箇所は各3箇所あります。

  • mirrorlistをコメントアウト
  • baseurlのコメントを外す
  • baseurlのmirror.centos.orgvault.centos.org

修正前の例

mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=os&infra=$infra
#baseurl=http://mirror.centos.org/centos/$releasever/os/$basearch/

修正後の例

#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=os&infra=$infra
baseurl=http://vault.centos.org/centos/$releasever/os/$basearch/

vimで置換する場合のコマンド

:%s/mirrorlist/#mirrorlist/g
:%s/#baseurl/baseurl/g
:%s/mirror.centos.org/vault.centos.org/g

修正後、再度yumを実行し動作することを確認しました。

以上です。

参考にさせてもらったサイト

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