Bootstrap FreeKB - YUM - Enable or disable a YUM repository
YUM - Enable or disable a YUM repository

Updated:   |  YUM articles

Let's say the /etc/yum.repos.d directory should contains the following files.

~]$ ll /etc/yum.repos.d/
-rw-r--r--. 1 root root 1664 Apr  7  2020 CentOS-Base.repo
-rw-r--r--. 1 root root 1309 Apr  7  2020 CentOS-CR.repo
-rw-r--r--. 1 root root  649 Apr  7  2020 CentOS-Debuginfo.repo
-rw-r--r--. 1 root root  314 Apr  7  2020 CentOS-fasttrack.repo
-rw-r--r--. 1 root root  630 Apr  7  2020 CentOS-Media.repo
-rw-r--r--. 1 root root 1331 Apr  7  2020 CentOS-Sources.repo
-rw-r--r--. 1 root root 7577 Apr  7  2020 CentOS-Vault.repo
-rw-r--r--. 1 root root  616 Apr  7  2020 CentOS-x86_64-kernel.repo
-rw-r--r--  1 root root 1050 Oct 31  2020 epel.repo
-rw-r--r--  1 root root 1149 Oct 31  2020 epel-testing.repo

 

In this example, in the /etc/yum.repos.d/epel.repo file, only the "epel" block is enabled (enabled=1). The epel-debuginfo and epel-source blocks are disabled (enabled=0). A block can be permanently enabled (1) or disabled (0) by editing the .repo file.

[epel]
name=Extra Packages for Enterprise Linux 7 - $basearch
#baseurl=http://download.fedoraproject.org/pub/epel/7/$basearch
metalink=https://mirrors.fedoraproject.org/metalink?repo=epel-7&arch=$basearch&infra=$infra&content=$contentdir
failovermethod=priority
enabled=1
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-7

[epel-debuginfo]
name=Extra Packages for Enterprise Linux 7 - $basearch - Debug
#baseurl=http://download.fedoraproject.org/pub/epel/7/$basearch/debug
metalink=https://mirrors.fedoraproject.org/metalink?repo=epel-debug-7&arch=$basearch&infra=$infra&content=$contentdir
failovermethod=priority
enabled=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-7
gpgcheck=1

[epel-source]
name=Extra Packages for Enterprise Linux 7 - $basearch - Source
#baseurl=http://download.fedoraproject.org/pub/epel/7/SRPMS
metalink=https://mirrors.fedoraproject.org/metalink?repo=epel-source-7&arch=$basearch&infra=$infra&content=$contentdir
failovermethod=priority
enabled=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-7
gpgcheck=1

 

Or, a block can be temporarily enabled using the yum install --enablerepo command.

yum install --enablerepo epel-debuginfo

 

A block can be temporarily disabled using the yum install --disablerepo command.

yum install --disablerepo epel-debuginfo

 




Did you find this article helpful?

If so, consider buying me a coffee over at Buy Me A Coffee



Comments


Add a Comment


Please enter da8e5c in the box below so that we can be sure you are a human.