Installing Git on CentOS 5.2

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:

Ingredients

  • 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.

HTH

About rlc

Software Analyst in embedded systems and C++, C and VHDL developer, I specialize in security, communications protocols and time synchronization, and am interested in concurrency, generic meta-programming and functional programming and their practical applications. I take a pragmatic approach to project management, focusing on the management of risk and scope. I have over two decades of experience as a software professional and a background in science.
This entry was posted in GNU/Linux (OS) and tagged . Bookmark the permalink.