To install the latest git on CentOS 5 you will need to install from source since the yum repos are typically fairly far behind. Follow the instructions below and installing git on CentOS 5.X will be a snap.
- Install Dependencies: First we need to install a couple packages via yum to cover the dependencies for building git from source.
- [root@server ~]#yum install curl-devel
- [root@server ~]#yum install expat-devel
- [root@server ~]#yum install gettext-devel
- [root@server ~]#yum install openssl-devel
- [root@server ~]#yum install zlib-devel
- Download git Source: Now download the git source by issuing the below command. Verify the latest source here.
- [root@server ~]#cd /usr/local/src
- [root@server ~]# wget http://www.kernel.org/pub/software/scm/git/git-1.6.0.4.tar.gz
- Build Source: Unpack the file that has been downloaded and compile the source using the “make” command.
- [root@server ~]#tar -zxvf git-1.6.0.4.tar.gz
- [root@server ~]#cd git-1.6.0.4
- [root@server ~]#make prefix=/usr/local all
- Install git: After successfully compiling the source you need to install git.
- [root@server ~]#make prefix=/usr/local/ install
- Download git Manpages: Now let’s download the manpages. Verify the latest manpages here.
- [root@server ~]#cd /usr/local/src
- [root@server ~]#wget http://www.kernel.org/pub/software/scm/git/git-manpages-1.6.0.4.tar.gz
- Install git Manpages: Now change into the share directory and unpack the git manpages.
- [root@server ~]#cd /usr/local/share/man
- [root@server ~]#tar -zxvf /usr/local/src/git-manpages-1.6.0.4.tar.gz
- Verify: Lets verify that git was installed successfully and the manpages are working properly.
- [root@server ~]#git --version
- [root@server ~]#man git
After following the above steps you should be able to successfully use git on your CentOS desktop or server. Git is a great version control system for any project.
Thanks, that was very exact and helpful.
Glad it helped!
Really good and simple walk-trough, perfect for beginners like me.
Thanks!
Hello Fran,
Thanks for the nice words. Glad you found the article easy to follow and useful.
Thanks.
alex
Too goood… Simple and best article. Which you can use blindly. Thanks for the cool artical.
Hello Avin,
Thank you. We working very hard to make sure all of our articles are easy to follow/understand. Thanks for taking the time to leave feedback.
Thanks.
alex
best instructions I’ve seen so far on the internet. Thanks.
only problem i ran into is my vmware CentOs image did not have GCC. so, i had to “yum install gcc”
Hello ravi,
Thanks for the compliment. Also thanks for providing information about your experience so if anyone else doesn’t have GCC installed they will be able to see it should be easy enough to install it and continue moving forward with installing the latest and greatest git package.
Thanks.
alex
bingo. :) dn’t have to luk anywhere else.. excellent job!
Hello Abhi,
Thanks and thank you for taking the time to leave feedback!
Thanks.
alex
Thank you so much! This article helped me out so much!
Hello Ben,
No problem. Thanks for posting feedback.
Thanks.
alex
Great stuff!
But, somehow I was not able to download git Manpages. Any way around?
I tried git archive –format=tar origin/man | sudo tar -x -C /usr/share/man/ -vf , but it throws some strange error (fatal: Not a valid object name).
Good luck
Hello Amit,
Sorry for the extremely delayed response. Not sure exactly what you were trying to do above. If you are still having the issue could you provide more details and if you resolved the issue could you post the resolution in response to this comment?
Thanks.
alex