Dependency errors for git installs on CentOS with EPEL repo

Here’s a dependency hell you can get into when running on CentOS systems with the EPEL repository enabled.

# yum repolist
...
base        CentOS-6 - Base                                    6,294
epel        Extra Packages for Enterprise Linux 5 - x86_64     7,048
extras      CentOS-6 - Extras                                  6

When you try to install git, perl dependencies cannot seem to be resolved.

# yum install git
...
--> Running transaction check
---> Package compat-expat1.x86_64 0:1.95.8-8.el6 will be installed
---> Package git.x86_64 0:1.7.4.1-1.el5 will be installed
--> Processing Dependency: libcurl.so.3()(64bit) for package: git-1.7.4.1-1.el5.x86_64
---> Package openssl098e.x86_64 0:0.9.8e-17.el6.centos.2 will be installed
---> Package perl-Git.x86_64 0:1.7.4.1-1.el5 will be installed
--> Processing Dependency: perl(:MODULE_COMPAT_5.8.8) for package: perl-Git-1.7.4.1-1.el5.x86_64
--> Finished Dependency Resolution
Error: Package: git-1.7.4.1-1.el5.x86_64 (epel)
           Requires: libcurl.so.3()(64bit)
Error: Package: perl-Git-1.7.4.1-1.el5.x86_64 (epel)
           Requires: perl(:MODULE_COMPAT_5.8.8)
 You could try using --skip-broken to work around the problem
 You could try running: rpm -Va --nofiles --nodigest

Seems like some conflicts occur whenever the EPEL repo is activated. A workaround is to run the yum install without the EPEL repo enabled, so everything is loaded from the base repositories and the dependencies can be resolved correctly.

# yum install git --disablerepo=epel

You’ll still run into problems with a ‘yum update’ later on, so you may have to permanently exclude both perl and git from the EPEL repositories.

# cat /etc/yum.repos.d/epel.repo
[epel]
name=Extra Packages for Enterprise Linux 5 - $basearch
#baseurl=http://download.fedoraproject.org/pub/epel/5/$basearch
mirrorlist=http://mirrors.fedoraproject.org/mirrorlist?repo=epel-5&arch=$basearch
failovermethod=priority
enabled=1
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL
exclude=perl* git*

By adding the last line in the first repo-block of the /etc/yum.repos.d/epel.repo file, you tell Yum to stop looking for updates to those packages in that repository. That will at least help until this dependency problem has been resolved within EPEL.