Skip to content

Instantly share code, notes, and snippets.

@matthewriley
Last active August 8, 2018 18:28
Show Gist options
  • Star 4 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save matthewriley/7128415 to your computer and use it in GitHub Desktop.
Save matthewriley/7128415 to your computer and use it in GitHub Desktop.
Install Git 1.8.4.1 from source on CentOS 6.4

Install Git 1.8.4.1 from source on CentOS 6.4

These are the Terminal commands I recently used (October 2013) to install Git 1.8.4.1 from source on CentOS 6.4. I ran this in a VirtualBox VM after a fresh install from the ISO.

If you are not running in a VirtualBox VM, you will need run the following first.

su
yum -y install gcc make
exit

You mileage will vary as the yum packages are updated over time. The yum install line below should include all the dependencies, at least it did for me. Depending upon how often you use yum update you may need to run yum --enablerepo=base clean metadata as su before you run the following commands.

cd ~/Downloads
su
yum -y install zlib-devel openssl-devel cpio expat-devel gettext-devel curl-devel perl-ExtUtils-CBuilder perl-ExtUtils-MakeMaker
wget -O v1.8.4.1.tar.gz https://github.com/git/git/archive/v1.8.4.1.tar.gz
tar -xzvf ./v1.8.4.1.tar.gz
cd git-1.8.4.1/
make prefix=/usr/local all
make prefix=/usr/local install
exit

At this point you can safely remove the git tar file and git directory from your Downloads directory. Git should now be configured according to the following:

$ which git
/usr/local/bin/git

$ git --version
git version 1.8.4.1

January 2014 update: Install Git 1.8.5.2 from source on CentOS 6.5

@jars99
Copy link

jars99 commented Oct 25, 2013

Thank you for posting this!

FYI - when I went to run your commands on my system, it failed at the first make command - I didn't have gcc installed. You probably installed the Developer Tools with your OS, so it wasn't a requirement for you.

@chrislentz
Copy link

I am getting the following error when I run make prefix=/usr/local all:

CC hash.o
GEN common-cmds.h
/bin/sh: ./generate-cmdlist.sh: Permission denied
make: *** [common-cmds.h] Error 126

Anyone know how I can fix this?

@clivesj
Copy link

clivesj commented Nov 21, 2013

Thanks! Works perfectly

@windchime18
Copy link

after executing this code "yum -y install zlib-devel openssl-devel cpio expat-devel gettext-devel curl-devel perl-ExtUtils-CBuilder perl-ExtUtils-MakeMaker"

i got this error at the end..

Downloading Packages:
warning: rpmts_HdrFromFdno: Header V3 DSA/SHA1 Signature, key ID 6b8d79e6: NOKEY
Retrieving key from file:///etc/pki/rpm-gpg/RPM-GPG-KEY-rpmforge-dag

GPG key retrieval failed: [Errno 14] Could not open/read file:///etc/pki/rpm-gpg/RPM-GPG-KEY-rpmforge-dag

@Japster24
Copy link

yum install gcc-c++.x86_64

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment