Last Updated: February 25, 2016
·
611
· gnrfan

Compiling latest git from sources on a CentOS box

First, you'll need to make sure you have all installed all the usual tools needed for compiling software from sources.

You can accomplish that with the following command:

yum groupinstall 'Development Tools'

Then, make sure you install dependencies that are specific to git:

yum install gettext-devel expat-devel curl-devel zlib-devel openssl-devel

Then, grab the latest source tarball with git's sources. Better go to the site but yourself and copy and paste the current link. If you just copy and paste my example you might end up installing and older version:

wget -c http://www.kernel.org/pub/software/scm/git/git-1.8.1.3.tar.bz2

Unpack the sources:

tar jxpf git-1.8.1.3.tar.bz2

Get into the folder, configure, compile and install:

cd git-1.8.1.3/
./configure --prefix=/usr --localstatedir=/var --sysconfdir=/etc --with-curl --with-expat
make
make install

Get rid of the folder. Perhaps keeping the tarball is fine, perhaps you can get rid of that too.

rm -Rf git-1.8.1.3/

And that's it. Now you can test the version of you shiny new git installation with this command:

git --version

You should obtain something like this as response:

git version 1.8.1.3