SysTutorials Forums QA How to exclude a package from a specific repository only in yum?

This post https://www.systutorials.com/1661/making-dnf-yum-not-update-certain-packages/ introduces how to exclude a package from yum.

But is it possible to exclude a package from a specific repository only?

For example, a repository R1 I am using contains an updated version of gdb while I don’t want to use the gdb from it as I trust the version (although older) from the official OS repository. How to make yum update not update gdb from the repository R1?

exclude=... can also be used in each repository’s .repo file under /etc/yum.repos.d.

For the above example, you can add

exclude=gdb

to

/etc/yum.repos.d/R1.repo

under the enabled (enabled=1) sections.

Example:

[epel]
name=Extra Packages for Enterprise Linux 7 - $basearch
metalink=https://mirrors.fedoraproject.org/metalink?repo=epel-7&arch=$basearch
failovermethod=priority
enabled=1
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-7
exclude=gdb
Reply To: How to exclude a package from a specific repository only in yum?
Your information:





<a href="" title="" rel="" target=""> <blockquote cite=""> <code> <pre> <em> <strong> <del datetime=""> <ul> <ol start=""> <li> <img src="" border="" alt="" height="" width="">

Please share if you like this post: