Skip to content

Instantly share code, notes, and snippets.

@eddarmitage
Created March 8, 2012 14:03
Show Gist options
  • Save eddarmitage/2001099 to your computer and use it in GitHub Desktop.
Save eddarmitage/2001099 to your computer and use it in GitHub Desktop.
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.

@garni-kh
Copy link

tnx tnx 1000 time

@cofyc
Copy link

cofyc commented Sep 29, 2013

Thanks a lot!

@tang9ian
Copy link

Thanks a lot! works...

@arcanosam
Copy link

works too! thanks bro! :D

@daniilyar
Copy link

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

@wasim117
Copy link

wasim117 commented Dec 8, 2013

How to update to latest version on centos?

@hpirosha
Copy link

Thanks ! It saved a lot of time.

@lawrencewu
Copy link

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

@DingK-R
Copy link

DingK-R commented Feb 13, 2014

Thanks!

@amitgaur
Copy link

Thanks!

@hallak
Copy link

hallak commented Mar 23, 2014

Very Good, Thanks !

@kbadruka
Copy link

Awesome, Thanks !!

@lookat23
Copy link

Thanks a lot!

@LuizeraSD
Copy link

Thanks! Saved my life 👍

@amarbs
Copy link

amarbs commented Aug 14, 2014

Thanks!!

@jsvisa
Copy link

jsvisa commented Aug 25, 2014

Thanks a lot!

@speedlight
Copy link

Thanks!!! This Gists is a lifesaver :D

@jonathanbak
Copy link

Thanks a lot!

@wiesson
Copy link

wiesson commented Dec 3, 2014

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

@thomasbennett
Copy link

Thanks!

@svambati
Copy link

Thanks for info

@grmca2010
Copy link

Thanks.. Works fine..

@mohsinrasool
Copy link

Thanks.. worked great!

@bhtak
Copy link

bhtak commented Jul 29, 2015

Thanks..

@tomket2
Copy link

tomket2 commented Sep 18, 2015

very nice. thank you!

@dcantera
Copy link

Awesome!

@ldco2016
Copy link

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

@Le0nX
Copy link

Le0nX commented Aug 21, 2017

Yeah. Doesn't work anymore...

@jcburley
Copy link

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
Copy link

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