ManyCodes.com – codes & scripts Get free programming codes and tutorials!

5Aug/090

How to Install the Latest git on CentOS 5 from Source

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 will be a snap.

  1. Install Dependencies: First we need to install a couple packages via yum to cover the dependencies for building git from source.
  2. [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 
[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
    

    [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
    
    [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
    
    [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
    [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
    
    [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
    
    [root@server ~]#git --version
    [root@server ~]#man git

    After following the above steps you should be able to successfully use git.

    [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



    Share and Enjoy: These icons link to social bookmarking sites where readers can share and discover new web pages.
    • Webnews
    • Digg
    • del.icio.us
    • StumbleUpon
    • Reddit
    • Ask
    • Facebook
    • Technorati
    • YahooBuzz