How to Install git 2.9 on a Directadmin Server with CentOS 6

By | March 16, 2018

Two years ago I have written a short guide on the same subject – here it is.

Since yum install git still doesn’t allow us to install git 2, let me share the fastest way to get git up and running on your server.

First of all, let’s download the most recent version of git here. Most recent version is 2.9.5 at the moment, so my command will be:

wget https://mirrors.edge.kernel.org/pub/software/scm/git/git-2.9.5.tar.gz

Let’s extract the archive we have:

tar xzvf git-2.9.5.tar.gz

Now we need to change directory and start the configuration process:

cd git-2.9.5

Let’s first ensure we have all the necessary packages for running git:

yum install autoconf cpio curl-devel expat-devel gcc gettext-devel make openssl-devel perl-ExtUtils-MakeMaker zlib-devel

Then let’s configure it:

make configure

You should see something like this:

[root@server git-2.9.5]# make configure
GIT_VERSION = 2.9.5
GEN configure

It’s fine, let’s go to further steps:

./configure --prefix=/usr/local/git

Then

make

Followed by

make install

Let’s create some symlinks (most probably you already have them)

ln -sv /usr/local/git/bin/* /usr/bin/

My output was the following:

[root@server git-2.9.5]# ln -sv /usr/local/git/bin/* /usr/bin/
`/usr/bin/git' -> `/usr/local/git/bin/git'
ln: creating symbolic link `/usr/bin/git-cvsserver': File exists
ln: creating symbolic link `/usr/bin/gitk': File exists
`/usr/bin/git-receive-pack' -> `/usr/local/git/bin/git-receive-pack'
`/usr/bin/git-shell' -> `/usr/local/git/bin/git-shell'
`/usr/bin/git-upload-archive' -> `/usr/local/git/bin/git-upload-archive'
`/usr/bin/git-upload-pack' -> `/usr/local/git/bin/git-upload-pack'

Fine, we are almost ready. Let’s see where is git.

whereis git

My output:

[root@server git-2.9.5]# whereis git
git: /usr/bin/git /usr/local/git

And finally, let’s check version:

git --version

Here is how it should look like:

[root@server git-2.9.5]# git --version
git version 2.9.5

That’s all. Have fun! :)

Leave a Reply