You are here

yum-config-manager --setopt=

It is common knowledge that on CentOS/RHEL hosts you can enable and disable defined reposities with the yum-config-manager. However it is also possible to use yum-config-manager tool to set any repository parameter using the setopt parameter.

One common site specific tweak is to exclude particular packages, by glob, from the default repositories. Perhaps you use the Samba packages from SetNET or the PostgreSQL packages from PGDG in which case you do not want to risk an update co-mingling packages. Rather than diddling in vi with every repository definition in every repo file it is possible to set the required option using yum-config-manager. Provide the configuration parameter you wish to set as the parameter value of --setopt= and indicate that you want to save the change with --save. setopt values spelling out as : reporsitoryName:parameter=value;

To exclude the glob "samba*" from all the default repositories:

yum-config-manager  --save --setopt=base.exclude=samba*;
yum-config-manager  --save --setopt=updates.exclude=samba*;
yum-config-manager  --save --setopt=extras.exclude=samba*;
yum-config-manager  --save --setopt=centosplus.exclude=samba*;
yum-config-manager  --save --setopt=contrib.exclude=samba*;"

If the host has EPEL or other repositories those will need to be disabled as well.

yum-config-manager beats a whole bunch of file edits, and it makes it possible to script deployments of hosts which require repository customization.

Theme by Danetsoft and Danang Probo Sayekti inspired by Maksimer