When working with older RHEL distributions like RHEL 6, package management can become challenging due to:
- Outdated default repositories
- Dependency chains breaking over time
- SSL certificate expiration issues
First, check your enabled repositories and their status:
yum repolist enabled
yum --disablerepo="*" --enablerepo="epel" list available
Before installing Git, ensure your system is properly prepared:
# Update all packages
yum update -y
# Clean yum cache
yum clean all
rm -rf /var/cache/yum
# Verify EPEL is properly configured
rpm -Uvh https://dl.fedoraproject.org/pub/epel/epel-release-latest-6.noarch.rpm
If the standard EPEL method fails, consider these approaches:
Method 1: Using IUS Repository
yum install -y https://repo.ius.io/ius-release-el6.rpm
yum install -y git2u
Method 2: Manual RPM Installation
For systems with strict security policies:
wget http://vault.centos.org/6.10/os/x86_64/Packages/git-1.7.1-9.el6.x86_64.rpm
wget http://vault.centos.org/6.10/os/x86_64/Packages/perl-Git-1.7.1-9.el6.noarch.rpm
rpm -ivh git-1.7.1-9.el6.x86_64.rpm perl-Git-1.7.1-9.el6.noarch.rpm
Method 3: Source Compilation
When all else fails, build from source:
yum groupinstall "Development Tools"
yum install -y curl-devel expat-devel gettext-devel openssl-devel zlib-devel
wget https://mirrors.edge.kernel.org/pub/software/scm/git/git-2.9.5.tar.gz
tar -xzf git-2.9.5.tar.gz
cd git-2.9.5
make prefix=/usr/local all
make prefix=/usr/local install
After successful installation, verify the installation:
git --version
which git
rpm -qa | grep git
- SSL certificate errors: Update CA certificates with
yum update ca-certificates
- Missing dependencies: Use
yum deplist git
to identify required packages - Repository metadata issues: Run
yum makecache fast
For ongoing maintenance of Git on RHEL 6:
- Regularly check the Red Hat lifecycle dates
- Consider setting up a local repository mirror for critical packages
- Document all manual installation steps for future reference
When attempting to install Git on RHEL 6 through EPEL repository, many developers encounter the frustrating "No package git available" error. Let's break down the solution with technical precision.
First, ensure your EPEL repository is properly configured and enabled:
# Check enabled repositories
yum repolist enabled
# Verify EPEL is properly installed
rpm -qa | grep epel-release
# If missing, install EPEL:
rpm -Uvh https://dl.fedoraproject.org/pub/epel/epel-release-latest-6.noarch.rpm
On RHEL 6, the Git package might have a different naming convention. Try these alternatives:
# Try alternative package names
yum install git-all
yum install git-core
yum install --enablerepo=epel git
If repository installation fails, here's a reliable manual method:
# Install required dependencies
yum install curl-devel expat-devel gettext-devel openssl-devel zlib-devel gcc perl-ExtUtils-MakeMaker
# Download and compile from source
cd /usr/src
wget https://mirrors.edge.kernel.org/pub/software/scm/git/git-2.9.5.tar.gz
tar -xzf git-2.9.5.tar.gz
cd git-2.9.5
make prefix=/usr/local all
make prefix=/usr/local install
# Verify installation
git --version
The IUS repo often provides more recent versions of Git:
# Add IUS repository
yum install https://repo.ius.io/ius-release-el6.rpm
# Install Git 2.x from IUS
yum install git2u
When facing dependency problems, these commands help resolve them:
# Clean yum cache
yum clean all
# Check for available git packages
yum --showduplicates list git*
# Resolve dependencies
yum deplist git
yum install $(repoquery --requires --resolve git)
Remember that RHEL 6 reached EOL in November 2020, so consider upgrading to a supported version if possible. For production systems, always test these procedures in a staging environment first.