ウェブサイト検索

Yumプラグインの有効化、無効化、およびインストール方法


YUMプラグインは、パッケージマネージャの全体的なパフォーマンスを拡張し改善する小さなプログラムです。それらのいくつかはデフォルトでインストールされており、多くはインストールされていません。Yumは、yumコマンドを実行する際に、ロードされていてアクティブなプラグインがある場合、そのプラグインを通知します。

この記事では、CentOS/RHELディストリビューションにおいてYUMパッケージマネージャプラグインをオンまたはオフにし、設定する方法を説明します。

すべてのアクティブなプラグインを表示するには、ターミナルでyumコマンドを実行します。以下の出力から、fastestmirrorプラグインが読み込まれていることがわかります。

# yum search nginx

Loaded plugins: fastestmirror
Repodata is over 2 weeks old. Install yum-cron? Or run: yum makecache fast
Determining fastest mirrors
...

YUMプラグインを有効にする

yumプラグインを有効にするには、/etc/yum.confファイルの[main]セクションに、plugins=1(1はオンを意味します)が存在することを確認してください。以下のように。

# vi /etc/yum.conf
[main]
cachedir=/var/cache/yum/$basearch/$releasever
keepcache=0
debuglevel=2
logfile=/var/log/yum.log
exactarch=1
obsoletes=1
gpgcheck=1
plugins=1 installonly_limit=5

これは、yumプラグインをグローバルに有効にする一般的な方法です。後ほど見ていくように、それらを受け入れた設定ファイルで個別に有効にすることもできます。

YUMプラグインの無効化

yumプラグインを無効にするには、上記の値を0(無効を意味します)に変更するだけで、すべてのプラグインがグローバルに無効になります。

plugins=0	

この段階では、次のことに注意することが重要です:

  • いくつかのプラグイン(例:product-idやsubscription-manager)は基本的なyum機能を提供するため、特に全体的にすべてのプラグインを無効にすることは推奨されません。
  • 次に、プラグインをグローバルに無効にすることは簡単な方法として許可されており、これはyumの問題を調査する際にこの規定を使用できることを示唆しています。
  • /etc/yum/pluginconf.d/ にさまざまなプラグインの設定があります。
  • /etc/yum.conf でプラグインをグローバルに無効にすると、個々の設定ファイルの設定が上書きされます。
  • また、後で説明するように、yumを実行する際に単一のyumプラグインまたはすべてのyumプラグインを無効にすることもできます。

追加のYUMプラグインのインストールおよび設定

このコマンドを使用して、すべてのyumプラグインとその説明のリストを表示できます。

# yum search yum-plugin

Loaded plugins: fastestmirror
Repodata is over 2 weeks old. Install yum-cron? Or run: yum makecache fast
Loading mirror speeds from cached hostfile
 * base: mirror.sov.uk.goscomb.net
 * epel: www.mirrorservice.org
 * extras: mirror.sov.uk.goscomb.net
 * updates: mirror.sov.uk.goscomb.net
========================================================================= N/S matched: yum-plugin ==========================================================================
PackageKit-yum-plugin.x86_64 : Tell PackageKit to check for updates when yum exits
fusioninventory-agent-yum-plugin.noarch : Ask FusionInventory agent to send an inventory when yum exits
kabi-yum-plugins.noarch : The CentOS Linux kernel ABI yum plugin
yum-plugin-aliases.noarch : Yum plugin to enable aliases filters
yum-plugin-auto-update-debug-info.noarch : Yum plugin to enable automatic updates to installed debuginfo packages
yum-plugin-changelog.noarch : Yum plugin for viewing package changelogs before/after updating
yum-plugin-fastestmirror.noarch : Yum plugin which chooses fastest repository from a mirrorlist
yum-plugin-filter-data.noarch : Yum plugin to list filter based on package data
yum-plugin-fs-snapshot.noarch : Yum plugin to automatically snapshot your filesystems during updates
yum-plugin-keys.noarch : Yum plugin to deal with signing keys
yum-plugin-list-data.noarch : Yum plugin to list aggregate package data
yum-plugin-local.noarch : Yum plugin to automatically manage a local repo. of downloaded packages
yum-plugin-merge-conf.noarch : Yum plugin to merge configuration changes when installing packages
yum-plugin-ovl.noarch : Yum plugin to work around overlayfs issues
yum-plugin-post-transaction-actions.noarch : Yum plugin to run arbitrary commands when certain pkgs are acted on
yum-plugin-priorities.noarch : plugin to give priorities to packages from different repos
yum-plugin-protectbase.noarch : Yum plugin to protect packages from certain repositories.
yum-plugin-ps.noarch : Yum plugin to look at processes, with respect to packages
yum-plugin-remove-with-leaves.noarch : Yum plugin to remove dependencies which are no longer used because of a removal
yum-plugin-rpm-warm-cache.noarch : Yum plugin to access the rpmdb files early to warm up access to the db
yum-plugin-show-leaves.noarch : Yum plugin which shows newly installed leaf packages
yum-plugin-tmprepo.noarch : Yum plugin to add temporary repositories
yum-plugin-tsflags.noarch : Yum plugin to add tsflags by a commandline option
yum-plugin-upgrade-helper.noarch : Yum plugin to help upgrades to the next distribution version
yum-plugin-verify.noarch : Yum plugin to add verify command, and options
yum-plugin-versionlock.noarch : Yum plugin to lock specified packages from being updated

プラグインをインストールするには、パッケージをインストールするのと同じ方法を使用します。例えば、更新の前後にパッケージの変更履歴を表示するために使用されるchangelogプラグインをインストールします。

# yum install yum-plugin-changelog 

インストールが完了すると、変更ログはデフォルトで有効になります。その確認のために、設定ファイルを見てください。

# vi /etc/yum/pluginconf.d/changelog.conf

これで、パッケージ(この場合はhttpd)の変更履歴を次のように表示できるようになりました。

# yum changelog httpd

Loaded plugins: changelog, fastestmirror
Loading mirror speeds from cached hostfile
 * base: mirrors.linode.com
 * epel: mirror.freethought-internet.co.uk
 * extras: mirrors.linode.com
 * updates: mirrors.linode.com

Listing all changelogs

==================== Installed Packages ====================
httpd-2.4.6-45.el7.centos.4.x86_64       installed
* Wed Apr 12 17:30:00 2017 CentOS Sources <[email > - 2.4.6-45.el7.centos.4
- Remove index.html, add centos-noindex.tar.gz
- change vstring
- change symlink for poweredby.png
- update welcome.conf with proper aliases
...

コマンドラインでYUMプラグインを無効にする

前述のように、これらの2つの重要なオプションを使用することで、yumコマンドを実行中に1つまたは複数のプラグインをオフにすることもできます。

  • --noplugins - すべてのプラグインをオフにします
  • --disableplugin=plugin_name – 単一のプラグインを無効にします

このyumコマンドのように、すべてのプラグインを無効にすることができます。

# yum search --noplugins yum-plugin

次のコマンドは、httpdパッケージをインストールする際に、プラグインfastestmirrorを無効にします。

# yum install --disableplugin=fastestmirror httpd

Loaded plugins: changelog
Resolving Dependencies
--> Running transaction check
---> Package httpd.x86_64 0:2.4.6-45.el7.centos.4 will be updated
--> Processing Dependency: httpd = 2.4.6-45.el7.centos.4 for package: 1:mod_ssl-2.4.6-45.el7.centos.4.x86_64
---> Package httpd.x86_64 0:2.4.6-67.el7.centos.6 will be an update
...

それでは、今回はここまでです!次にご紹介するYUM関連の記事もぜひご覧ください。

  1. 'Yum History'を使用してインストールまたは削除されたパッケージ情報を確認する方法
  2. Yumエラー: データベースディスクイメージが破損していますを修正する方法

このガイドでは、CentOS/RHEL 7 の YUM パッケージマネージャープラグインをアクティブ化、構成、または無効化する方法を説明しました。この記事について質問がある場合や意見を共有したい場合は、下のコメントフォームを使用してください。

関連記事: