How to set priority to specific repositories on systems registered to RHN Classic or Red Hat Satellite v 5.x or Red Hat Satellite v 6.x?

Solution Verified - Updated

Environment

  • Red Hat Enterprise Linux (RHEL)
  • Red Hat Network and Red Hat Satellite v 5.x
  • Red Hat Satellite v 6.x
  • yum-priorities plugin.

Issue

  • How to assign priorities to specific repositories for particular groups or packages?
  • How to prioritize repositories on client system which are registered with RHN Classic or Red Hat Satellite v 5.x?

Resolution

  • The yum-priorities plugin can be used to assign different priorities to particular repositories. Packages in a lower priority repository can not replace packages installed from repositories with higher priority, even if it has an updated version.

  • In RHEL 5 the package name is yum-priorities. In RHEL 6 and RHEL7 the package name is yum-plugin-priorities and is available in the Optional channel. Before subscribing to the Optional channel see the Scope of Coverage Details page. If you decide to install packages from this channel, follow the steps documented in the article called How to access Optional and Supplementary channels, and -devel packages using Red Hat Subscription Manager (RHSM)? on the Red Hat Customer Portal.

  • Main configuration file of this plugin is /etc/yum/pluginconf.d/priorities.conf. Each .repo file in /etc/yum.repos.d/ may include priority=N to indicate the priority, where N is an integer between 1 and 99. The value 1 has the highest priority and 99 the lowest. By default the repository inherits a low priority with N=99.

  • Examples or use cases:

    • To prioritize repositories coming from RHN priorities can be mentioned in /etc/yum/pluginconf.d/rhnplugin.conf file,
        ---------------------
        [rhel-i386-server-6]
        # higher priority
        priority=10
    
        [rhel-i386-server-optional-6]
        # lower priority
        priority=30
        ----------------------
    
    • Another use case, two custom repositories are configured and need prioritize packages from them. In this case add priority in individual repository files located in /etc/yum.repos.d/ directory,
        # cat /etc/yum.repos.d/repo1.repo
        name=repo1
        baseurl=ftp://repo1.example.com/pub/
        enabled=1
        priority = 1
    
        # cat /etc/yum.repos.d/repo2.repo
        name=repo2
        baseurl=ftp://repo2.example.com/pub/
        enabled=1
        priority = 2
    

For more KB articles/solutions related to Red Hat Satellite 6.x Repository Issues, please refer to the Red Hat Satellite Consolidated Troubleshooting Article for Red Hat Satellite 6.x Repository Issues.

SBR
Components
Category

This solution is part of Red Hat’s fast-track publication program, providing a huge library of solutions that Red Hat engineers have created while supporting our customers. To give you the knowledge you need the instant it becomes available, these articles may be presented in a raw and unedited form.