Introduction

In this guide, we are about to start with how to install Git on Centos, RHEL, Oracle 6/7/8 Linux versions.

Git is a software used for version control. It designed especially for programmers to version control. It supports almost most of all programming codes. Junio C Hamano a Japanese software engineer who developed it, the initial version released long back by 2005 and licenced under GPLv2.

Resolve the Dependencies

Install the required dependencies

# yum install curl-devel expat-devel gettext-devel openssl-devel zlib-devel -y
# yum install gcc perl-ExtUtils-MakeMaker -y

Download Git Source

Download the latest tar file from kernel.org. If you wish to download an older version you can find the same from below URL.

https://mirrors.edge.kernel.org/pub/software/scm/git/

Let us download the latest version for now.

# cd /usr/local/
# wget https://mirrors.edge.kernel.org/pub/software/scm/git/git-2.23.0.tar.gz
Download Git from the kernel.org
Download Git from the kernel.org

Extract and Prepare

Once downloaded the tar file extract and navigate to the extracted directory. It’s better to move the extracted content under /usr/local/ to start the compile future.

# tar zxvf git-2.23.0.tar.gz
# cd git-2.23.0/

Compile and Install

Once navigated to the extracted directory start to prepare for installation by running make.

# make prefix=/usr/local/git all
Run make to prepare for installation
Run make to prepare for installation

Then run install to start the installation.

# make prefix=/usr/local/git install
Install the Git
Install the Git

Define Environment Variable

Set the environment Variable to run git commands from any location. Once done source it.

# echo "export PATH=$PATH:/usr/local/git/bin" >> /etc/bashrc
# source /etc/bashrc

Or exit the session and re-login.

Verify Version

After completing with the installation let us check for the installed version by running

# git --version

We have installed with the latest version from the kernel.org.

[root@corcls3 ~]# git --version
git version 2.23.0
[root@corcls3 ~]#

The above steps are working perfectly on RHEL based operating system versions 6,7 and 8 as well. We have tested and worked perfectly. In case, if you have any issue while compiling or installing kindly let us know through the comment section.

Conclusion

Git used for version control by most of all programmer. Above guide walk through how to setup git from the downloaded source. Subscribe to the newsletter and stay tuned for upcoming articles. Your feedbacks are welcome through below comment section.

LEAVE A REPLY

Please enter your comment!
Please enter your name here