How to disable YUM package repository on CentOS

In order to disable YUM package repository on CentOS we first need to get a unique repository ID using the following yum command:

# yum repolist
Loaded plugins: fastestmirror, langpacks
Loading mirror speeds from cached hostfile
 * base:
 * epel:
 * extras:
 * updates:
repo id              repo name                                            status
base/7/x86_64        CentOS-7 - Base                                      8,652
epel/x86_64          Extra Packages for Enterprise Linux 7 - x86_64       8,935
extras/7/x86_64      CentOS-7 - Extras                                      285
google-chrome        google-chrome                                            3
isv_ownCloud_desktop The ownCloud Desktop Client (CentOS_7)                  63
updates/7/x86_64     CentOS-7 - Updates                                   1,726
virtualbox/7/x86_64  Oracle Linux / RHEL / CentOS-7 / x86_64 - VirtualBox    13

Now choose the repo ID you wish to disable and execute yum-config-manager --disable command with a relevant repo ID as its argument. For example the below command will disable google-chrome repository:

# yum-config-manager --disable google-chrome

Now run yum repolist command to confirm that the repository was disabled correctly.