logo logo

Installing Git on CentOS 5

I have made the switch from SVN to Git for all of my projects and I'm loving it. So I decided as part of my deployment process, I would install Git on my server and use Git to fetch the release code to the deployment folder. This is alot like I did with Subversion, using svn export to push a tagged release to the server. Installing Git was quite simple even though there is no package for CentOS 5 yet. Here is the process I used to set it up.

The following packages are dependancies for Git, so make sure they are installed.

yum installĀ zlib-devel

yum install openssl-develĀ 

yum install perl

yum install cpio

yum install expat-devel

yum install gettext-devel

Next, if you do not already have Curl installed, follow the next step to get it up and running.

wget http://curl.haxx.se/download/curl-7.18.0.tar.gz

tar xzvf curl-7.18.0.tar.gz

cd curl-7.18.0

./configure

make

make install

Next, make sure /usr/local/lib is in your ld.so.conf, this is required for git-http-push to correctly link up to the Curl version you are installing.

vi /etc/ld.so.conf

(Insert the following)

/usr/local/lib

Save the file, then run:

ldconfig

Now download and install Git

wget http://www.codemonkey.org.uk/projects/git-snapshots/git/git-latest.tar.gz

tar xzvf git-latest.tar.gz

cd git-{date}

autoconf

./configure --with-curl=/usr/local

make

make install

Thats all there is to it! Simple enough. I will post a follow up on how I actually deploy using Git in the near future.

bottom

14 Comments »

  1. Rich Rich Says:
    Thanks! Worked for me on a Rimuhosting CentOS5 install. Only exceptions were:

    -I had to install autoconf:
    sudo yum install autoconf

    -ldconfig was not in my path, so I executed:
    /sbin/ldconfig

    -curl was already installed, so I had to modify the path to curl to configure:
    ./configure --with-curl=/usr/bin

    Cheers :)
  2. Hates_ Hates_ Says:
    Thanks! I was surprised to find there wasn't a git package yet.
  3. David Linsin David Linsin Says:
    Thank a lot for this manual! Even without no knowledge of CentOS I was able to install git in 10 minutes!
  4. David Beckwith David Beckwith Says:
    If you already have curl installed in /usr/bin then the configure command should be:

    ./configure --with-curl=/usr

    not

    ./configure --with-curl=/usr/bin

    Please correct me if I'm wrong.
  5. Rob Hawkes Rob Hawkes Says:
    Great tutorial. I'm a newbie at command line installations and I had Git up and running in no time. Thank you.
  6. Alfred Farrington Alfred Farrington Says:
    Everything looks good for a newbie except for they need to install autoconf (yum install autoconf) otherwise they won't be able to do that step. So you should put that line in or in a parenthesis that autoconf needs to be installed.
  7. Dave Dave Says:
    Thank you for the directions. I was surprised git is not included in the default rpm repos. After installing autoconf this install from source went fine. Thank you!
  8. Gaurav Narain Saxena Gaurav Narain Saxena Says:
    Your post inspired me to install Git in a VirtualBox virtual machine of CentOS 5 for my development environment.

    Thanks a lot, can't wait for the next few posts you might have!

    @gsvolt
  9. Alex Alex Says:
    Thanks for this post, just worked like a charm for me. Although (I'm still pretty new to this), autoconf wasn't needed in my case.
  10. Rich Rich Says:
    Thanks this also worked for me - I too had to use the ./configure --with-curl=/usr command as I already had curl installed.
  11. Steve Boyd Steve Boyd Says:
    Thanks for posting this. Worked for me as is!!
  12. yair yair Says:
    alwhen i reached the
    ./configure --with-curl=/usr/local
    i got a "configure: error: no acceptable C compiler found in $PATH"
    i first had to get gcc installed
    yum install gcc
  13. Brian Fritton Brian Fritton Says:
    Worked awesomely, thank you!
  14. J Toman J Toman Says:
    Oh. the old-fashioned way, actually building the tool. Yeah, I remember when we did that. ;-)

    Thanks for the post.

Leave a comment