Forked from mahamuniraviraj/installLatestGitOnCentOs7.txt
Created
April 13, 2018 16:49
-
-
Save quangnd/4cb672515436d479cb295561c246619d to your computer and use it in GitHub Desktop.
Install Latest Git On Cent OS 7
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Centos 7.3 comes with 1.8.3 | |
# so update git from centos repo | |
yum update git | |
# it shows nothing to update | |
# we download git source and build and install latest git on Centos 7.3 | |
# Go to https://github.com/git/git/releases to get latest git release | |
# download tar.gz file in /opt folder https://github.com/git/git/archive/vX.XX.XX.tar.gz XX is versio no | |
cd /opt | |
ll | |
# extract tar.gz | |
tar -zxf vX.XX.X.tar.gz | |
cd vX.XX.X | |
# install development tools | |
yum groupinstall 'Development Tools' | |
yum install curl-devel expat-devel gettext-devel openssl-devel zlib-devel perl-ExtUtils-MakeMaker | |
# confirm we are in git source directory | |
pwd | |
# Compile git from sources | |
make prefix=/usr/local/git all | |
# install git | |
make prefix=/usr/local/git install | |
# Check version | |
git --version | |
# still shows version 1.8 | |
set path to new version | |
# create script file to set path | |
vi /etc/profile.d/setGitPath.sh | |
# press insert and type following commands | |
#!/bin/sh | |
# set git path to latest installed git version 2.13.0 (/usr/local/git/bin/git) | |
# instead of preinstalled git version 1.8.3 (/bin/git) | |
export PATH=/usr/local/git/bin:$PATH | |
#press escape and type :wqa to save and exit | |
# apply changes | |
source /etc/profile.d/setGitPath.sh | |
# check version | |
git --version | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment