Skip to content

Instantly share code, notes, and snippets.

@tsalzer
Created July 13, 2009 15:50
Show Gist options
  • Save tsalzer/146206 to your computer and use it in GitHub Desktop.
Save tsalzer/146206 to your computer and use it in GitHub Desktop.
Install git on CentOS 5.x
#!/bin/bash
#
# install git on CentOS 5.x
# see https://gist.github.com/gists/146206
#
# originally found at
# http://www.how-to-linux.com/2009/01/install-git-161-on-centos-52/
#
# You need to run this as root (at least the yum and make install bits).
#
# adapted a bit...
# define the git version.
# Originally, the default was 1.6.3, but as of 2011-05-19 the latest
# version is 1.7.5.1.
GIT_VERSION=${GIT_VERSION:-"1.7.6"}
echo "Git version to install: ${GIT_VERSION}"
# maybe set proxy -- better do that in your env :)
#export http_proxy=http://proxy:8080/
# install dependencies:
# general git stuff, plus gcc (in case it's not installed), plus
# plus xauth (for sshd X11 forwarind), plus tk for GUI, plus xterm
yum install -y gettext-devel expat-devel curl-devel zlib-devel openssl-devel \
gcc xauth tk xterm
# Get the git source code
wget http://kernel.org/pub/software/scm/git/git-${GIT_VERSION}.tar.gz
# untar the git source code
tar xvfz git-${GIT_VERSION}.tar.gz
# Install
cd git-${GIT_VERSION}
make prefix=/usr/local all
make prefix=/usr/local install
@paulthomas
Copy link

Thanks. Since the latest version is 1.7.6 ["today"=12July2011] - I updated the version info. Line[20] I commented out (no "export http_proxy.."). Installed with no errors. Host is CentOS 5.6. Thanks again.

@tsalzer
Copy link
Author

tsalzer commented Jul 13, 2011

Good point, updated the version and commented out the proxy. Glad it helped, thank you for your feedback. :)

@ontologist
Copy link

Works great! Thank you.

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