This guide explains how to enable or disable yum/dnf repository, this can be done temporarily through the command line or permanently by editing the repo configuration file.
Follow the guide:
To temporarily enable or Disable a Repo (CLI Method)
- Enable a disabled repo for one command:
yum --enablerepo=repo-name install package
# or
dnf --enablerepo=repo-name install package
- Disable a repo for one command:
yum --disablerepo=repo-name update
# or
dnf --disablerepo=repo-name update
To permanently enable or disable a Repo
- List all available repositories using the following command:
yum repolist all
# or
dnf repolist all
- Edit the repository file:
Repo files are located in:/etc/yum.repos.d/
To edit a specific repo (e.g., kb.repo):
sudo vi /etc/yum.repos.d/kb.repo
- Change the enabled line:
To disable:enabled=0
To enable:
enabled=1
- Save and exit.
This way, you can enable or disable yum/dnf repository. If you need further assistance, do contact our support specialists. They are available for you 24X7.
Next step in managing YUM/DNF: Learn How to clear the Yum cache