How to Install git on a Directadmin Server, running CentOS 6

By | February 17, 2016

It’s a strange thing that such a popular software is not yet included into Directadmin custombuild, but you are always welcome to install it by yourself.  Let me start this brief tutorial about git installation.

If you need a quick solution, you can use yum:

yum install git

But this will allow you to install version 1.7, that is quite outdated (though fully functional). If you want to have the most current version, you will have to perform some more steps. :) Here they are:

First of all, let’s install some server software that is required for running git:

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

Then we’ll need the most current version (2.7.1 at the moment, you can check it here).

wget https://www.kernel.org/pub/software/scm/git/git-2.7.1.tar.gz

2016-02-17_175209

Let’s unpack and continue:

tar xzvf git-2.7.1.tar.gz
cd git-2.7.1

Proceeding to further configuration:
make prefix=/usr/local/git all

You might receive an error message about libiconv (utf8.c:463: undefined reference to `libiconv’):

2016-02-17_175712

In this case, we’ll need to omit iconv (I don’t think we’ll need it):

make prefix=/usr/local/git all CFLAGS=-liconv

Then run
make prefix=/usr/local/git install

Same thing – if you got the error message about iconv on a previous stage, you need to input

make prefix=/usr/local/git install CFLAGS=-liconv

Ok, we’re almost done. Let’s export the path:

echo "export PATH=$PATH:/usr/local/git/bin" >> /etc/bashrc
source /etc/bashrc

That’s it! Let’s check git version:

git --version

You should see something like

2016-02-17_180719

Now you’re welcome to use it as you like. :)

One thought on “How to Install git on a Directadmin Server, running CentOS 6

  1. Wouter

    Great tutorial, thanks for posting!

    If you get notices like this:
    git: /usr/local/lib/libz.so.1: no version information available (required by git)

    run:
    rm /usr/local/lib/libz.so.1 && ln -s /usr/lib/libz.so.1.2.3 /usr/local/lib/libz.so.1

    Reply

Leave a Reply

Your email address will not be published. Required fields are marked *