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.
31 Comments
Trackbacks/Pingbacks
- rhythmicalmedia.com » Blog Archive » Phantom JS on Centos5 - [...] http://angry-fly.com/2009/03/installing-git-on-centos-5/ [...]
- Installing GIT | miketmoore.com - [...] Source This entry was tagged CentOS 5.6, Git. Bookmark the permalink. [...]
- Useful links | Unusual subroutines - [...] Git install on CentOS: http://angry-fly.com/2009/03/installing-git-on-centos-5/ [...]






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
Thanks! I was surprised to find there wasn’t a git package yet.
Thank a lot for this manual! Even without no knowledge of CentOS I was able to install git in 10 minutes!
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.
Great tutorial. I’m a newbie at command line installations and I had Git up and running in no time. Thank you.
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.
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!
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
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.
Thanks this also worked for me – I too had to use the ./configure –with-curl=/usr command as I already had curl installed.
Thanks for posting this. Worked for me as is!!
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
Worked awesomely, thank you!
Oh. the old-fashioned way, actually building the tool. Yeah, I remember when we did that.
Thanks for the post.
Awesome post! Thanks.
Saved me. Thanks!
You rock! Worked flawlessly, many thanks.
Thanks!
Another option, would be to use the EPEL repository:
https://fedoraproject.org/wiki/EPEL/FAQ#howtouse
All you need to do is this:
rpm -Uvh http://download.fedora.redhat.com/pub/epel/5/i386/epel-release-5-4.noarch.rpm
yum install git
Hey,
Thanks a million ran in a jiffy .
P.S :- I wonder why are RPM’s still painful
Awesome ….It was so simple and it worked perfectly for me on the Cent OS.
Thank you!
I love when things work! Thanks for sharing.
Centos 5
Ruby (1.9.2)
Rails 3
Thank you, super helpful!
Thanks, I couldn’t have done it without you!
I had to yum install make
Thanks, thanks, thanks… Save me lots of time and trouble.
Yup, this worked better for me.
Thank You! I’ve follow the instructions in CentOS 5.7 Final and works great!
Nice tutorials
Yeah works fine. But if you have centos5 min image installed you need some more packages. In my case the following ones:
yum install gcc make autoconf
Notice: curl was already available thow yum. ==> yum install curl // works fine for me…
All other packages I had already installed…
THX for your work