なんでもノート

t0m00m0tのノート。

yumでEPELを使う

目的

リソース取得コマンドを調べていてhtopを見つけたが、CentOSではデフォルトでインストールされていない。yum installしたが、どうやらEPELリポジトリからRPMをダウンロードできるよう設定する必要があるらしい。設定メモとして残す。

そもそもEPELとは?

Extra Package for Enterprise Linuxの略。fedora WIKIによると次のとおり。

エンタープライズ Linux 用の拡張パッケージ(EPEL) は、 Red Hat Enterprise Linux (RHEL) 向けの高品質なアドオンパッケージであり、CentOSScientific Linux (SL) のような RHEL からスピンオフしたディストリビューションと互換性のある、Fedora プロジェクトで有志によって作成されたパッケージになります。

しかし「エンタープライズ」と言いながら商用サポートなしとFAQにあるので注意。

EPEL は Red Hat が商用サポートしてるの? いいえ、していません。EPEL は Fedora コミュニティからの有志によって作成されたものです。ちょうど Fedora のように、Red Hat はこのプロジェクトのインフラをホスティングしていて、Red Hat のエンジニアはメンテナやリーダーとして関わりますが、EPEL パッケージには Red Hat が提供する SLA(Service Level Agreement) や商用サポートはありません。

EPELレポジトリのインストール

yumで簡単にインストールできる。

# yum install epel-release
読み込んだプラグイン:fastestmirror
base                                                               | 3.6 kB  00:00:00     
extras                                                             | 3.4 kB  00:00:00     
updates                                                            | 3.4 kB  00:00:00     
(1/2): extras/7/x86_64/primary_db                                  | 166 kB  00:00:00     
(2/2): updates/7/x86_64/primary_db                                 | 6.0 MB  00:00:01     
Determining fastest mirrors
 * base: mirror.fairway.ne.jp
 * extras: ftp.jaist.ac.jp
 * updates: mirror.qoxy.com
依存性の解決をしています
--> トランザクションの確認を実行しています。
---> パッケージ epel-release.noarch 0:7-9 を インストール
--> 依存性解決を終了しました。

依存性を解決しました

==========================================================================================
 Package                   アーキテクチャー    バージョン       リポジトリー         容量
==========================================================================================
インストール中:
 epel-release              noarch              7-9              extras               14 k

トランザクションの要約
==========================================================================================
インストール  1 パッケージ

総ダウンロード容量: 14 k
インストール容量: 24 k
Is this ok [y/d/N]: y
Downloading packages:
epel-release-7-9.noarch.rpm                                        |  14 kB  00:00:00     
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
  インストール中          : epel-release-7-9.noarch                                   1/1 
  検証中                  : epel-release-7-9.noarch                                   1/1 

インストール:
  epel-release.noarch 0:7-9                                                               

完了しました!

yumリポジトリの設定

このままyum installすると、公式パッケージではなく、EPELパッケージでインストールされてしまう。通常はEPELを無効化して、必要な時に使うようにする。

# vi /etc/yum.repos.d/epel.repo
[epel]
enabled=0 

インストール直後はenabled=1になってる。

EPELを使う

yumにオプション--enablerepo=epel `を指定する。

# yum --enablerepo=epel search htop
読み込んだプラグイン:fastestmirror
epel/x86_64/metalink                                               | 6.5 kB  00:00:00     
epel                                                               | 4.7 kB  00:00:00     
(1/3): epel/x86_64/group_gz                                        | 266 kB  00:00:00     
(2/3): epel/x86_64/updateinfo                                      | 895 kB  00:00:00     
epel/x86_64/primary_db         FAILED                                          
https://repo.fedoralinux.ir/pub/epel/7/x86_64/repodata/b470635ba85e2bed51d930468c38b4a9baede67fc606054ae08987a3c506679d-primary.sqlite.bz2: [Errno 14] HTTPS Error 404 - Not Found
他のミラーを試します。
To address this issue please refer to the below knowledge base article 

https://access.redhat.com/articles/1320623

If above article doesn't help to resolve this issue please create a bug on https://bugs.centos.org/

(3/3): epel/x86_64/primary_db                                      | 6.3 MB  00:00:01     
Loading mirror speeds from cached hostfile
 * base: mirror.fairway.ne.jp
 * epel: mirrors.nipa.cloud
 * extras: ftp.jaist.ac.jp
 * updates: mirror.qoxy.com
=================================== N/S matched: htop ====================================
htop.x86_64 : Interactive process viewer

  Name and summary matches only, use "search all" for everything.
[root@cent01 yum.repos.d]# 
[root@cent01 yum.repos.d]# 
[root@cent01 yum.repos.d]# yum --enablerepo=epel install htop
読み込んだプラグイン:fastestmirror
Loading mirror speeds from cached hostfile
 * base: mirror.fairway.ne.jp
 * epel: mirror01.idc.hinet.net
 * extras: ftp.jaist.ac.jp
 * updates: mirror.qoxy.com
依存性の解決をしています
--> トランザクションの確認を実行しています。
---> パッケージ htop.x86_64 0:2.0.2-1.el7 を インストール
--> 依存性解決を終了しました。

依存性を解決しました

==========================================================================================
 Package           アーキテクチャー    バージョン                 リポジトリー       容量
==========================================================================================
インストール中:
 htop              x86_64              2.0.2-1.el7                epel               98 k

トランザクションの要約
==========================================================================================
インストール  1 パッケージ

総ダウンロード容量: 98 k
インストール容量: 207 k
Is this ok [y/d/N]: y
Downloading packages:
警告: /var/cache/yum/x86_64/7/epel/packages/htop-2.0.2-1.el7.x86_64.rpm: ヘッダー V3 RSA/SHA256 Signature、鍵 ID 352c64e5: NOKEY
htop-2.0.2-1.el7.x86_64.rpm の公開鍵がインストールされていません
htop-2.0.2-1.el7.x86_64.rpm                                        |  98 kB  00:00:00     
file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-7 から鍵を取得中です。
Importing GPG key 0x352C64E5:
 Userid     : "Fedora EPEL (7) <epel@fedoraproject.org>"
 Fingerprint: 91e9 7d7c 4a5e 96f1 7f3e 888f 6a2f aea2 352c 64e5
 Package    : epel-release-7-9.noarch (@extras)
 From       : /etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-7
上記の処理を行います。よろしいでしょうか? [y/N]y
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
  インストール中          : htop-2.0.2-1.el7.x86_64                                   1/1 
  検証中                  : htop-2.0.2-1.el7.x86_64                                   1/1 

インストール:
  htop.x86_64 0:2.0.2-1.el7                                                               

完了しました!

EPEL以外のリポジトリ

EPEL以外の追加リポジトリを調べたいときは以下サイトを参考にする。

yumリポジトリ一追加リスト 完全版