Is it possible to enable / disable yum repository using dnf?

1

2

How to enable/disable yum repo (i.e. set enabled=0/1 in /etc/yum.repo.d/*.repo files) using dnf?

According to question yum: enable a disabled repository yum can't do that.

Used system: Fedora 21

czerny

Posted 2015-03-31T14:08:44.057

Reputation: 352

Answers

10

Enable a repository:

dnf config-manager --set-enabled <repo>

Disable a repository:

dnf config-manager --set-disabled <repo>

Show help:

dnf config-manager --help-cmd

The first two should be run with superuser rights.

DNF config-manager Plugin documentation.

gal242

Posted 2015-03-31T14:08:44.057

Reputation: 215

1It works since Fedora 22. – czerny – 2015-05-28T19:13:08.120

1

on 21 yum is still the default package tool. so you would either: 1) yum-config-manager --save --disablerepo=foo (replace foo with reponame.repo)

2) sudo vi (or any other comfy editor) /etc/yum.repos.d/foo.repo and edit the enabled=0/1 line and save (while a # yum clean all ; #yum update is not generally required it is generally seen as a good practice)

dnf can do the exact same but as mentioned above dnf is not default till 22 ( still in RC state thru may 5 2015) and has some known issues with fc21 consider looking at yum-dnf-$arch in the interim as well as a possible workaround / crutch...

linuxdev2013

Posted 2015-03-31T14:08:44.057

Reputation: 1 051