Wednesday, 14 February 2018

upgrade 'git' to 2.x Redhat/CentOS

Tried to upgrade 'git' to latest as I had few applications which was not supported with older git which suggested me for 2.x. while I, tried to 'yum update git' I couldn't find 2.x being in Redhat/Oracle repository. Later, followed to install manually and these steps were documented below instructions. 


- Ensure your packages are installed(curl-devel expat-devel gettext-devel openssl-devel zlib-devel gcc perl-ExtUtils-MakeMaker)
- Remove installed 'git' from system
- Download the latest version from (I would download git-2.8.6)
- Install git.
- Make sure you add in PATH of your profile.
- Check your 'git' version. 


[root@localhost ~]# yum install curl-devel expat-devel gettext-devel openssl-devel zlib-devel gcc perl-ExtUtils-MakeMaker -y
Loaded plugins: aliases, changelog, kabi, ovl, presto, refresh-packagekit, security, tmprepo, ulninfo, verify, versionlock
Loading support for kernel ABI
Setting up Install Process
Package libcurl-devel-7.19.7-53.el6_9.x86_64 already installed and latest version
Package expat-devel-2.0.1-13.el6_8.x86_64 already installed and latest version
Package gettext-devel-0.17-18.el6.x86_64 already installed and latest version
Package openssl-devel-1.0.1e-57.0.1.el6.x86_64 already installed and latest version
Package zlib-devel-1.2.3-29.el6.x86_64 already installed and latest version
Package gcc-4.4.7-18.el6.x86_64 already installed and latest version
Package perl-ExtUtils-MakeMaker-6.55-144.el6.x86_64 already installed and latest version
Nothing to do
[root@localhost ~]# 

[root@localhost ~]# yum remove git -y
Setting up Remove Process
Resolving Dependencies
--> Running transaction check
---> Package git.x86_64 0:1.7.1-9.el6_9 will be erased
--> Processing Dependency: git = 1.7.1-9.el6_9 for package: perl-Git-1.7.1-9.el6_9.noarch
--> Running transaction check
---> Package perl-Git.noarch 0:1.7.1-9.el6_9 will be erased
--> Finished Dependency Resolution
Removed: git.x86_64 0:1.7.1-9.el6_9
Dependency Removed: perl-Git.noarch 0:1.7.1-9.el6_9
[root@localhost ~]#

[root@localhost ~]# cd /usr/src
Resolving, 2604:1380:3000:3500::3
Connecting to||:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 5859600 (5.6M) [application/x-gzip]
Saving to: "git-2.8.6.tar.gz"

100%[===================================================================================================================================>] 5,859,600    185K/s   in 41s

2018-02-13 20:01:07 (140 KB/s) - "git-2.8.6.tar.gz" saved [5859600/5859600]

[root@localhost src]# tar xzf git-2.8.6.tar.gz
[root@localhost src]# cd git-2.8.6
[root@localhost git-2.8.6]# make prefix=/usr/local/git all
* new build flags
CC credential-store.o
* new link flags
CC abspath.o
CC advice.o
CC alias.o
CC alloc.o
CC archive.o
CC archive-tar.o
CC archive-zip.o
CC argv-array.o
* new prefix flags
CC attr.o
CC base85.o

[root@localhost git-2.8.6]# make prefix=/usr/local/git install
/usr/bin/perl Makefile.PL PREFIX='/usr/local/git' INSTALL_BASE='' --localedir='/usr/local/git/share/locale'
Writing perl.mak for Git
GEN git-add--interactive
GEN git-difftool
GEN git-archimport
GEN git-cvsexportcommit
GEN git-cvsimport
GEN git-cvsserver
GEN git-relink
GEN git-send-email
GEN git-svn

./check_bindir "z$bindir" "z$execdir" "$bindir/git-add"
[root@localhost git-2.8.6]# echo "export PATH=$PATH:/usr/local/git/bin" >>/etc/bashrc
[root@localhost git-2.8.6]# source /etc/bashrc
[root@localhost git-2.8.6]#

[root@localhost ~]# git --version
git version 2.8.6
[root@localhost ~]#