Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Installing git on CentOS 5 using yum

Installing git on CentOS 5 using yum

Since you're using CentOS 5, the default package manager is yum, not apt-get. To install a program using it, you'd normally use the following command:

$ sudo yum install <packagename>

However, when trying to install git this way, you'll encounter the following error on CentOS 5:

$ sudo yum install git
Setting up Install Process
Parsing package install arguments
No package git available.
Nothing to do

This tells you that the package repositories that yum knows about don't contain the required rpms (RPM Package Manager files) to install git. This is presumably because CentOS 5 is based on RHEL 5, which was released in 2007, before git was considered a mature version control system. To get around this problem, we need to add additional repositories to the list that yum uses (We're going to add the RPMforge repository, as per these instructions).

This assumes you want the i386 packages. Test by running uname -i. If you want the x86_64 packages, replace all occurrences of i386 with x86_64 in the following commands

First, download the rpmforge-release package:

$ wget http://packages.sw.be/rpmforge-release/rpmforge-release-0.5.2-2.el5.rf.i386.rpm

Next, verify and install the package:

$ rpm --import http://apt.sw.be/RPM-GPG-KEY.dag.txt
$ rpm -K rpmforge-release-0.5.2-2.el5.rf.i386.rpm
$ rpm -i rpmforge-release-0.5.2-2.el5.rf.i386.rpm

And now we should be able to install git:

$ sudo yum install git-gui

yum will work out the dependancies, and ask you at relevant points if you want to proceed. Press y for Yes, and n or return for No.

@eddarmitage

This comment has been minimized.

Copy link
Owner Author

@eddarmitage eddarmitage commented Mar 12, 2012

Answer now provided here

@iancrowther

This comment has been minimized.

Copy link

@iancrowther iancrowther commented Oct 2, 2012

Superb, many thanks

@pookieman

This comment has been minimized.

Copy link

@pookieman pookieman commented Mar 25, 2013

Great help thanks!

@CodyErekson

This comment has been minimized.

Copy link

@CodyErekson CodyErekson commented Apr 2, 2013

Finally...this is just what I needed. Thanks a lot!

@evilHead

This comment has been minimized.

Copy link

@evilHead evilHead commented Apr 17, 2013

Works like a charm!

@ildarusmanov

This comment has been minimized.

Copy link

@ildarusmanov ildarusmanov commented May 7, 2013

Thanks a lot!

@CreepGin

This comment has been minimized.

Copy link

@CreepGin CreepGin commented May 13, 2013

$ wget http://packages.sw.be/rpmforge-release/rpmforge-release-0.5.2-2.el5.rf.x86_64.rpm

$ rpm --import http://apt.sw.be/RPM-GPG-KEY.dag.txt
$ rpm -K rpmforge-release-0.5.2-2.el5.rf.x86_64.rpm
$ rpm -i rpmforge-release-0.5.2-2.el5.rf.x86_64.rpm

$ sudo yum install git-gui
@milushov

This comment has been minimized.

Copy link

@milushov milushov commented May 21, 2013

hey guys, how upgrade git version, without updating all other packages in system? (i don't want use yum update)

@shenyubao

This comment has been minimized.

Copy link

@shenyubao shenyubao commented Jun 9, 2013

It works .Thanks a lot

@yamgit

This comment has been minimized.

Copy link

@yamgit yamgit commented Jul 12, 2013

thanks man. it is a great gist.

@garni-kh

This comment has been minimized.

Copy link

@garni-kh garni-kh commented Aug 19, 2013

tnx tnx 1000 time

@cofyc

This comment has been minimized.

Copy link

@cofyc cofyc commented Sep 29, 2013

Thanks a lot!

@tang9ian

This comment has been minimized.

Copy link

@tang9ian tang9ian commented Oct 29, 2013

Thanks a lot! works...

@arcanosam

This comment has been minimized.

Copy link

@arcanosam arcanosam commented Nov 8, 2013

works too! thanks bro! :D

@daniilyar

This comment has been minimized.

Copy link

@daniilyar daniilyar commented Nov 27, 2013

WOW!!! Thanks a lot, you saved my time

@wasim117

This comment has been minimized.

Copy link

@wasim117 wasim117 commented Dec 8, 2013

How to update to latest version on centos?

@hpirosha

This comment has been minimized.

Copy link

@hpirosha hpirosha commented Jan 13, 2014

Thanks ! It saved a lot of time.

@lawrencewu

This comment has been minimized.

Copy link

@lawrencewu lawrencewu commented Feb 10, 2014

it doesn't work to me, I cannot connect to the server

@DingK-R

This comment has been minimized.

Copy link

@DingK-R DingK-R commented Feb 13, 2014

Thanks!

@amitgaur

This comment has been minimized.

Copy link

@amitgaur amitgaur commented Mar 19, 2014

Thanks!

@hallak

This comment has been minimized.

Copy link

@hallak hallak commented Mar 23, 2014

Very Good, Thanks !

@kbadruka

This comment has been minimized.

Copy link

@kbadruka kbadruka commented May 20, 2014

Awesome, Thanks !!

@lookat23

This comment has been minimized.

Copy link

@lookat23 lookat23 commented Jun 18, 2014

Thanks a lot!

@LuizeraSD

This comment has been minimized.

Copy link

@LuizeraSD LuizeraSD commented Jul 3, 2014

Thanks! Saved my life 👍

@amarbs

This comment has been minimized.

Copy link

@amarbs amarbs commented Aug 14, 2014

Thanks!!

@jsvisa

This comment has been minimized.

Copy link

@jsvisa jsvisa commented Aug 25, 2014

Thanks a lot!

@speedlight

This comment has been minimized.

Copy link

@speedlight speedlight commented Nov 26, 2014

Thanks!!! This Gists is a lifesaver :D

@jonathanbak

This comment has been minimized.

Copy link

@jonathanbak jonathanbak commented Nov 28, 2014

Thanks a lot!

@wiesson

This comment has been minimized.

Copy link

@wiesson wiesson commented Dec 3, 2014

Still usefull, thanks!
I've used version 0.5.3-1 instead of 2-2.

@thomasbennett

This comment has been minimized.

Copy link

@thomasbennett thomasbennett commented Feb 5, 2015

Thanks!

@svambati

This comment has been minimized.

Copy link

@svambati svambati commented Apr 28, 2015

Thanks for info

@grmca2010

This comment has been minimized.

Copy link

@grmca2010 grmca2010 commented Jun 3, 2015

Thanks.. Works fine..

@mohsinrasool

This comment has been minimized.

Copy link

@mohsinrasool mohsinrasool commented Jun 18, 2015

Thanks.. worked great!

@bhtak

This comment has been minimized.

Copy link

@bhtak bhtak commented Jul 29, 2015

Thanks..

@tomket2

This comment has been minimized.

Copy link

@tomket2 tomket2 commented Sep 18, 2015

very nice. thank you!

@dcantera

This comment has been minimized.

Copy link

@dcantera dcantera commented Dec 19, 2015

Awesome!

@ldco2016

This comment has been minimized.

Copy link

@ldco2016 ldco2016 commented Oct 21, 2016

I don't think this works anymore, I keep getting Connection timed out.

@Le0nX

This comment has been minimized.

Copy link

@Le0nX Le0nX commented Aug 21, 2017

Yeah. Doesn't work anymore...

@jcburley

This comment has been minimized.

Copy link

@jcburley jcburley commented Nov 10, 2017

The server (listed in the instructions) no longer exists under that name.

But rpmfind.net has info on these, and its own .dag.txt file to import. Worth searching for, if you're willing to deal with dependency hell even after you get this far....

@rafzei

This comment has been minimized.

Copy link

@rafzei rafzei commented Mar 7, 2018

Now you can find rpms on rpmfind.net:
wget https://www.rpmfind.net/linux/dag/redhat/el5/en/i386/dag/RPMS/rpmforge-release-0.5.3-1.el5.rf.i386.rpm
rpm -i rpmforge-release-0.5.3-1.el5.rf.i386.rpm
if error like this occured:
file /etc/smart/channels/rpmforge.channel from install of rpmforge-release-0.5.3-1.el5.rf.i386 conflicts with file from package rpmforge-release-0.5.3-1.el5.rf.x86_64 file /etc/sysconfig/rhn/sources.rpmforge.txt from install of rpmforge-release-0.5.3-1.el5.rf.i386 conflicts with file from package rpmforge-release-0.5.3-1.el5.rf.x86_64
please use --replacefiles flag.

yum update && yum install git-all -y

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.