Building Git on Red Hat-based systems

I had a case where I had to build Git on an older Red Hat based system. Unfortunately, the system was so old that yum wasn't really supported. So I had to install the needed libraries (RPMs) "by hand" via rpm -i. There was one package that I had to update via rpm -U.

On my rather bare system, I found I had to install the following RPMs to get Git to compile :

cpp
curl
curl-devel
e2fsprogs-devel
gcc
glibc-devel
glibc-headers
glibc-kernheaders
krb5-devel
krb5-libs
make
openssl
openssl-devel
wget
zlib-devel

The above two curl libraries are not required if you don't need curl. Without curl you have no git-http-pull/push and no http nor https transports. I also didn't want to install the libraries for Tcl/TK. This means no GUI tools, but using things like vimdiff should suffice.

Based on the libraries we chose to omit, edit the Makefile to ignore these two dependencies :

NO_TCLTK=true

...
STRIP ?= strip

#DKL - Add this line
NO_CURL = true

# Among the variables below, these:
...

Here's the actual build procedure :


# cd /tmp
# mkdir gitSrc
# cd gitSrc
# wget http://git-core.googlecode.com/files/git-1.7.6.3.tar.gz
# gunzip 1.7.6.3.tar.gz
# tar -xvf 1.7.6.3.tar
# cd git-1.7.6.3
# vi Makefile    (make above edits)
# make           (just try to make and ensure all libraries are there)
# make clean     (start over)
# make prefix=/usr install           (
# which git
/usr/bin/git
# git --version
git version 1.7.6.3
Categories: