I’m pretty sure that I’m not the first one to run into this, so I thought I’d blog how this works.

As I said earlier, one of my clients uses CentOS 5.2 in their production environment, so I need a CentOS 5.2 development server set up. I use Git for all projects I can use it on so I needed to install Git on CentOS 5.2. There is no RPM package for CentOS 5.2 for Git (the RPM package at kernel.org is for Fedora) so I had to build from source. Here’s how I did it:


  • Git sources:

    $ wget

  • Build-time dependencies:

    $ sudo yum install curl-devel expat-devel

Now you can make git by running

$ make

Personally, I install packages like these, which are not part of the OS, in my home directory, under opt, which you can do like this:

$ make prefix=${HOME}/opt

This should build without warning or error. You can now install it like this:

$ make prefix=${HOME}/opt install

(Don’t forget to re-specify the prefix: not doing so will force a complete re-build).

If you want to make your own RPM of Git, you need to clone git from the git repository: the “rpm” target uses git-archive, which needs to be run in a git repository.