34
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

エニプラAdvent Calendar 2023

Day 23

【備忘録】RHEL7.2でyumコマンドを使用可能にする

Last updated at Posted at 2023-12-22

はじめに

RHEL7.2において、yumコマンドが使用できない事象が発生しました。
この記事では備忘録として、RHEL7.2でyumコマンドを使用可能にする手順を記載します。

環境

OS
 RHEL7.2(yum使用不可サーバ)
 RHEL7.9(パッケージダウンロード用サーバ)

1. RHEL 7.2で発生した事象

RHEL7.2でyumコマンドを実行したところ、以下のような結果が返ってきました。

RHEL7.2
# yum list
Loaded plugins: amazon-id, rhui-lb, search-disabled-repos
Could not contact CDS load balancer rhui2-cds01.ap-northeast-1.aws.ce.redhat.com, trying others.


Could not contact any CDS load balancers: rhui2-cds01.ap-northeast-1.aws.ce.redhat.com, rhui2-cds02.ap-northeast-1.aws.ce.redhat.com.

原因としてはrh-amazon-rhui-clientが2.x以下であると、リポジトリにアクセスできないためです。
下記のコマンドで現在のバージョンを確認します。

RHEL7.2
# rpm -qa rh-amazon-rhui-client
rh-amazon-rhui-client-2.2.124-1.el7.noarch

2. 対処方法

対処方法としては以下の流れです。

①まず初めにrh-amazon-rhui-clientが3.x以上のサーバはRHEL7.9を用います。
 今回使用したAMIは[ami-00e3b125d72527ff6]です。

RHEL7.9
# rpm -qa rh-amazon-rhui-client
rh-amazon-rhui-client-3.0.45-1.el7.noarch

②上記で構築したサーバで、最新のrh-amazon-rhui-clientをダウンロードします。
 実行コマンドは以下です。

RHEL7.9
# yumdownloader rh-amazon-rhui-client
Loaded plugins: amazon-id
rh-amazon-rhui-client-4.0.13-1.el7.noarch.rpm                                                                                                                         |  39 kB  00:00:00

③ダウンロードしたパッケージをscpなど用いて、yumのできないサーバにアップロードします。

④アップロードしたサーバでパッケージを、下記コマンドを使用しインストールします。

RHEL7.2
# yum localinstall rh-amazon-rhui-client-4.0.13-1.el7.noarch.rpm
実行結果
# yum localinstall rh-amazon-rhui-client-4.0.13-1.el7.noarch.rpm
Loaded plugins: amazon-id, rhui-lb, search-disabled-repos
Examining rh-amazon-rhui-client-4.0.13-1.el7.noarch.rpm: rh-amazon-rhui-client-4.0.13-1.el7.noarch
Marking rh-amazon-rhui-client-4.0.13-1.el7.noarch.rpm as an update to rh-amazon-rhui-client-2.2.124-1.el7.noarch
Resolving Dependencies
--> Running transaction check
---> Package rh-amazon-rhui-client.noarch 0:2.2.124-1.el7 will be updated
---> Package rh-amazon-rhui-client.noarch 0:4.0.13-1.el7 will be an update
--> Finished Dependency Resolution

Dependencies Resolved

=============================================================================================
 Package               Arch   Version       Repository                                  Size
=============================================================================================
Updating:
 rh-amazon-rhui-client noarch 4.0.13-1.el7  /rh-amazon-rhui-client-4.0.13-1.el7.noarch  68 k

Transaction Summary
=============================================================================================
Upgrade  1 Package

Total size: 68 k
Is this ok [y/d/N]: y
Downloading packages:
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
  Updating   : rh-amazon-rhui-client-4.0.13-1.el7.noarch                                 1/2
warning: /etc/yum.repos.d/redhat-rhui-client-config.repo saved as /etc/yum.repos.d/redhat-rhui-client-config.repo.rpmsave
warning: /etc/yum.repos.d/redhat-rhui.repo saved as /etc/yum.repos.d/redhat-rhui.repo.rpmsave
[INFO:choose_repo] choose_repo:36 2023-12-21 08:51:31,098: Enabling binary repos in redhat-rhui.repo
[INFO:choose_repo] choose_repo:55 2023-12-21 08:51:31,098: Enabling client config repo
[INFO:choose_repo] choose_repo:65 2023-12-21 08:51:31,099: Executing [sed -i 's/enabled=0/enabled=1/' /etc/yum.repos.d/redhat-rhui-client-config.repo]
  Cleanup    : rh-amazon-rhui-client-2.2.124-1.el7.noarch                                2/2
warning: /etc/yum/pluginconf.d/rhui-lb.conf saved as /etc/yum/pluginconf.d/rhui-lb.conf.rpmsave
warning: /etc/yum.repos.d/rhui-load-balancers.conf saved as /etc/yum.repos.d/rhui-load-balancers.conf.rpmsave
  Verifying  : rh-amazon-rhui-client-4.0.13-1.el7.noarch                                 1/2
  Verifying  : rh-amazon-rhui-client-2.2.124-1.el7.noarch                                2/2

Updated:
  rh-amazon-rhui-client.noarch 0:4.0.13-1.el7

Complete!

⑤キャッシュのクリアをします。

RHEL7.2
# yum clean all
Loaded plugins: amazon-id, search-disabled-repos
Cleaning repos: rhel-7-server-rhui-rh-common-rpms rhel-7-server-rhui-rpms
              : rhui-client-config-server-7
Cleaning up everything

⑥動作確認をします。
以下のコマンドを実行し、エラーなく動作すれば解決です。

RHEL7.2
# yum list
34
1
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
34
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?