Installing git on CentOS 5.2
CentOS for all intents and purposes is a community supported clone of Red Hat Enterprise Linux (RHEL). If you want to run RHEL without paying for support, CentOS is as good as it gets. One of the hallmarks of Enterprise Linux distributions is their rock-steady stability i.e. they only run really boring, old software. This risk-aversion has a downside in restricted access to the latest and greatest packages and tools. Case in point, since Red Hat released RHEL 5.0 in March 2007, Git has really matured from its origins as a custom kernel development tool into a version control world-beater. Unfortunately the base CentOS 5.2 repositories don’t appear to contain rpms for git. Or at least the CentOS 5.2 AMI I’m using (ami-e300e68a) doesn’t:
-bash-3.2# yum install git Loading "fastestmirror" plugin Loading mirror speeds from cached hostfile ... [snip] ... No package git available. Nothing to do
Not to fear, RPMforge maintains an RPM repository for CentOS full of goodies, including git (1.5.x as of this writing). The CentOS Wiki provides detailed instructions on configuring RPMforge access, but here’s the rapid-fire how-to.
Install priorities to avoid conflicts between packages in RPMforge and the Base CentOS repositories:
-bash-3.2# yum install yum-priorities ... [snip] ... Installed: yum-priorities.noarch 0:1.1.16-13.el5.centos Complete!
To configure priorities first edit /etc/yum.repos.d/CentOS-Base.repo and add a priority=N line to each entry. For [base], [updates], [addons], and [extras] set N to 1. For [centosplus] set N to 2. Also edit /etc/yum.repos.d/rpmforge.repo and for [rpmforge] set N > 2. (I chose 4 because its the next power of 2, and that’s how I roll).
Verify our access to RPMforge with a check-update:
-bash-3.2# yum check-update |grep forge * rpmforge: ftp-stud.fht-esslingen.de ... [snip] ...
Finally install git:
-bash-3.2# yum install git ... [snip] ... Complete!
Enjoy the tasty DVCS goodness!