Zoeken op website

Hoe Yum-plug-ins in-, uitschakelen en installeren


YUM plug-ins zijn kleine programma's die de algehele prestaties van de pakketbeheerder uitbreiden en verbeteren. Een paar daarvan zijn standaard geïnstalleerd, terwijl veel dat niet zijn. Yum laat u altijd weten welke plug-ins, indien aanwezig, geladen en actief zijn wanneer u een yum-opdracht uitvoert.

In dit korte artikel leggen we uit hoe u YUM-pakketbeheerplug-ins in CentOS/RHEL-distributies kunt in- of uitschakelen en configureren.

Om alle actieve plug-ins te zien, voer je een yum-opdracht uit op de terminal. Uit de onderstaande uitvoer kunt u zien dat de plug-in fastestmirror is geladen.

yum search nginx

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

YUM-plug-ins inschakelen

Om yum plug-ins in te schakelen, zorg ervoor dat de richtlijn plugins=1 (1 betekenis aan) bestaat onder de [main] sectie in de /etc/yum.conf bestand, zoals hieronder weergegeven.

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

Dit is een algemene methode om yum plug-ins wereldwijd in te schakelen. Zoals we later zullen zien, kunt u ze afzonderlijk inschakelen in hun receptieve configuratiebestanden.

YUM-plug-ins uitschakelen

Om yum plug-ins uit te schakelen, verander je simpelweg de bovenstaande waarde in 0 (wat betekent uit), waardoor alle plug-ins globaal worden uitgeschakeld.

plugins=0	

In dit stadium is het nuttig om op te merken dat:

  • Omdat een paar plug-ins (zoals product-id en subscription-manager) fundamentele yum-functionaliteiten bieden, wordt het niet aanbevolen om alle plug-ins uit te schakelen, vooral niet wereldwijd.
  • Ten tweede is het wereldwijd uitschakelen van plug-ins toegestaan als een gemakkelijke uitweg, en dit houdt in dat je deze voorziening kunt gebruiken bij het onderzoeken van een waarschijnlijk probleem met yum.
  • Configuraties voor verschillende plug-ins bevinden zich in /etc/yum/pluginconf.d/.
  • Als u plug-ins globaal uitschakelt in /etc/yum.conf worden de instellingen in individuele configuratiebestanden overschreven.
  • En je kunt ook een enkele of alle yum plug-ins uitschakelen als je yum uitvoert, zoals later beschreven.

Extra YUM-plug-ins installeren en configureren

Met deze opdracht kun je een lijst bekijken van alle yum-plug-ins en hun beschrijvingen.

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

Om een plug-in te installeren, gebruikt u dezelfde methode als voor het installeren van een pakket. We zullen bijvoorbeeld de plug-in changelog installeren die wordt gebruikt om pakketchangelogs voor/na het updaten weer te geven.

yum install yum-plugin-changelog 

Zodra u de installatie heeft uitgevoerd, wordt changelog standaard ingeschakeld. Kijk ter bevestiging in het configuratiebestand.

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

Nu kunt u de changelog voor een pakket (httpd in dit geval) als deze bekijken.

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

Schakel YUM-plug-ins uit op de opdrachtregel

Zoals eerder vermeld kunnen we ook een of meer plug-ins uitschakelen terwijl een yum-commando wordt uitgevoerd door deze twee belangrijke opties te gebruiken.

  • --noplugins – schakelt alle plug-ins uit
  • --disableplugin=plugin_name – schakelt een enkele plug-in uit

Je kunt alle plug-ins uitschakelen zoals in dit yum-commando.

yum search --noplugins yum-plugin

Met het volgende commando wordt de plug-in fastestmirror uitgeschakeld tijdens het installeren van het httpd pakket.

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

Dat is het voor nu! Misschien vind je het ook leuk om deze volgende YUM-gerelateerde artikelen te lezen.

  1. Hoe u ‘Yum History’ kunt gebruiken om informatie over geïnstalleerde of verwijderde pakketten te achterhalen
  2. Yum-fout oplossen: databaseschijfimage is verkeerd ingedeeld

In deze handleiding hebben we laten zien hoe u YUM-pakketbeheerplug-ins in CentOS/RHEL 7 kunt activeren, configureren of deactiveren. Gebruik het onderstaande commentaarformulier om vragen te stellen of uw mening over dit artikel te delen.