Install Git Specific Version in Linux CentOS

From Gejoreuy
Revision as of 10:02, 12 September 2020 by Gejor (talk | contribs) (→‎Step by Step)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Step by Step

Prerequisites.

[root@gejoreuy ~]# yum install curl-devel expat-devel gettext-devel openssl-devel zlib-devel
[root@gejoreuy ~]# yum install gcc perl-ExtUtils-MakeMaker

Install Git (as example, we install git version 2.25.0; we can change the version with our needs).

[root@gejoreuy ~]# cd /root/Downloads
[root@gejoreuy Downloads]# wget https://mirrors.edge.kernel.org/pub/software/scm/git/git-2.25.0.tar.gz
[root@gejoreuy Downloads]# tar xzf git-2.25.0.tar.gz

Compile the source code.

[root@gejoreuy Downloads]# cd git-2.25.0
[root@gejoreuy git-2.25.0]# make prefix=/usr/local/git all
[root@gejoreuy git-2.25.0]# make prefix=/usr/local/git install

Setup environment.

[root@gejoreuy git-2.25.0]# echo 'export PATH=/usr/local/git/bin:$PATH' >> /etc/bashrc
[root@gejoreuy git-2.25.0]# source /etc/bashrc

Check if the installation successfully with checking the git version.

[root@gejoreuy git-2.25.0]# git --version