Friday, April 8, 2022

[SOLVED] yum + how to enable repo in yum when enabled=0

Issue

we have the following repo on our rhel 7.2 server

as we can see we set the enabled=0 , as default

more infra-update.repo
[infra-76-update]
name=infra 76 update
baseurl=http://linux_machine/infra-76
gpgcheck=0
enabled=0

but in case we want to use this repo - infra-7.6 , we wripte the following yum syntax

yum --disablerepo=* --enablerepo=infra-76 update -y

but we get

Error getting repository data for infra-76, repository not found

but when we set the enabled=1 , then we can do the installation of yum successfully with - ( yum --disablerepo=* --enablerepo=infra-76 update -y )

but the question is:

is it possible to enable repo as yum --disablerepo=* --enablerepo=infra-76 , while enabled=0 ??

NOTE - the target is to install the rpm's from repo infra-76 in spite the parameter in repo config is enabled=0


Solution

you can use the yum-config-manager (you might need to install yum-utils) :

yum-config-manager --enable infra-76

The flags --disablerepo and --enablerepo disable/enable the repositories temporarily (just for that command, in this case just for running yum update this one time).



Answered By - Chris Maes
Answer Checked By - Dawn Plyler (WPSolving Volunteer)