Installing Third-Party Yum Repositories on CentOS

Because I needed to configure some features on CentOS and the yum repositories that come with the system aren’t comprehensive enough — which is a real pain — I searched on Baidu and found third-party yum repositories.

  1. Install the third-party EPEL software repository

     rpm -ivh http://dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm
    
  2. Import the key (things will break if you don’t)

     rpm --import /etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-6
    
  3. Download the server’s package information and cache it locally on your machine

     yum makecache
    

    A long wait……

  4. Install the yum-plugin-priorities plugin. This plugin is used to guarantee the order of the software repositories when installing software. Usually, by default, it installs from the official base or mirror first, then from software contributed by community users, and then from third-party software repositories.

     yum install yum-plugin-priorities
    

Enable the feature:

    vim /etc/yum/pluginconf.d/priorities.conf

    [main] enabled=1

Set the priority rules

[base], [addons], [updates], [extras] ... priority=1
 [centosplus] priority=1 (same priority as base and updates) but should be left disabled [contrib] ... priority=2
 Third Party Repos ... priority=N (where N is > 10 and based on your preference)

Edit the /etc/yum.repos.d/CentOS-Base.repo file and add entries according to the rules above.

Then edit the /etc/yum.repos.d/epel.repo file and add priority=11 as the last line of [epel]. The lower the priority number, the higher the priority. The packages in there are pretty comprehensive too..