Sådan aktiveres, deaktiveres og installeres Yum Plug-ins


YUM-plugins er små programmer, der udvider og forbedrer den samlede ydelse for pakkehåndteringen. Et par af dem er installeret som standard, mens mange ikke er det. Yum giver dig altid besked om, hvilke plugins der er indlæst og aktive, når du kører en yum-kommando.

I denne korte artikel vil vi forklare, hvordan du tænder eller slukker og konfigurerer YUM-pakkehåndterings-plugins i CentOS/RHEL-distributioner.

For at se alle aktive plug-ins skal du køre en yum-kommando på terminalen. Fra nedenstående output kan du se, at den hurtigste Mirror-plug-in er indlæst.

# yum search nginx

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

Aktivering af YUM-plugins

For at aktivere yum-plugins skal du sikre dig, at direktivet plugins = 1 (1 betydning til) findes under [main] sektionen i /etc/yum.conf filen, som vist nedenfor.

# 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

Dette er en generel metode til at aktivere yum-plugins globalt. Som vi vil se senere, kan du aktivere dem individuelt i deres modtagelige konfigurationsfiler.

Deaktivering af YUM-plugins

For at deaktivere yum-plugins skal du blot ændre værdien ovenfor til 0 (hvilket betyder off), hvilket deaktiverer alle plugins globalt.

plugins=0	

På dette stadium er det nyttigt at bemærke, at:

  • Da nogle få plug-ins (såsom produkt-id og abonnementsadministrator) tilbyder grundlæggende yum-funktioner, anbefales det ikke at slå alle plugins fra specielt globalt.
  • For det andet er deaktivering af plug-ins globalt tilladt som en nem udvej, og dette indebærer, at du kan bruge denne bestemmelse, når du undersøger et sandsynligt problem med yum.
  • Konfigurationer til forskellige plug-ins findes i /etc/yum/pluginconf.d/.
  • Deaktivering af plugins globalt i /etc/yum.conf tilsidesætter indstillinger i individuelle konfigurationsfiler.
  • Og du kan også deaktivere et enkelt eller alle yum-plugins, når du kører yum, som beskrevet senere.

Installation og konfiguration af ekstra YUM-plugins

Du kan se en liste over alle yum-plugins og deres beskrivelser ved hjælp af denne kommando.

# 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

For at installere et plugin skal du bruge den samme metode til installation af en pakke. For eksempel installerer vi changelog-plug-in, der bruges til at vise pakke changelogs før/efter opdatering.

# yum install yum-plugin-changelog 

Når du har installeret, vil changelog være aktiveret som standard for at bekræfte, se på dens konfigurationsfil.

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

Nu kan du se changelog for en pakke (httpd i dette tilfælde) som denne.

# 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
...

Deaktiver YUM-plugins i kommandolinjen

Som nævnt før kan vi også slå et eller flere plugins fra, mens vi kører en yum-kommando ved at bruge disse to vigtige muligheder.

  • --noplugins - deaktiverer alle plug-ins
  • --disableplugin = plugin_name - deaktiverer et enkelt plug-ins

Du kan deaktivere alle plugins som i denne yum-kommando.

# yum search --noplugins yum-plugin

Den næste kommando deaktiverer plug-in, hurtigstemirror under installation af httpd-pakke.

# 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
...

Det er det for nu! du kan også godt lide at læse disse følgende YUM-relaterede artikler.

  1. Sådan bruges 'Yum History' til at finde ud af oplysninger om installerede eller fjernede pakker
  2. Sådan løses Yum-fejl: Databasediskbillede er forkert

I denne vejledning viste vi, hvordan du aktiverer, konfigurerer eller deaktiverer YUM-pakkehåndterings-plugins i CentOS/RHEL 7. Brug kommentarformularen nedenfor til at stille spørgsmål eller dele dine synspunkter om denne artikel.