Disable a repo
Feb 2021
Introduction
repo files, in CentOS are located in '/etc/yum.repo.d'. These files hold information (URLs) about where repositories are for CentOS programs (tcpdump, htop, nload etc.)
Each repo has it's own file, CentOS-Base.repo, epel-release.repo etc.
Occasionally we might want to ignore or remove a repo file, in this example there is a repo file called cdrom.repo that I need to ignore/delete.
To temporarily ignore a repo, we can use the following syntax:
sudo yum disablerepo=cdrom install yum-utils -y
This is two commands combined. sudo yum install yum-utils -y and yum disablerepo=cdrom.
This allows us to install yum-utils while telling CentOS to ignore repositories listed in the cdrom.repo file.
If we wish to disable a repo permanently then we can use the following syntax:
sudo yum-config-manager –disable cdrom
This will tell yum-config-manager to disable the repo file cdrom (note we do not require the .repo extension)
For this to work the yum-config-manager must have been installed (yum install yum-config-manager).