Upgrade and install git for Linux CentOS

Time:2021-5-4

preface

The default installation git version of CentOS is 1.8, but if we want to upgrade it, we need to compile and install it ourselves

environment

  • Install dependencies first
    yum install gcc
    yum install curl-devel expat-devel gettext-devel openssl-devel zlib-devel
    yum install gcc perl-ExtUtils-MakeMaker

Download and install

  • go toMirror siteDownload git manually, or we can use WGet to download the latest 2.9.5
    wget https://mirrors.edge.kernel.org/pub/software/scm/git/git-2.9.5.tar.gz
  • decompression
    tar -zxf git-2.9.5.tar.gz
  • Enter directory
    cd git-2.9.5
  • Configure the detection and set the installation directory
    ./configure --prefix=/usr/local/git
  • Compile and install
    make && make install

Configure environment variables

We need to configure environment variables to use git command globally

  • Configure environment variables in profile
    echo 'export PATH=$PATH:/usr/local/git/bin' > /etc/profile.d/git.sh
  • Refresh the environment variable to take effect
    source /etc/profile

    OK

    [[email protected] git-2.9.5]# git --version
    git version 2.9.5

This work adoptsCC agreementReprint must indicate the author and the link of this article

Recommended Today

Large scale distributed storage system: Principle Analysis and architecture practice.pdf

Focus on “Java back end technology stack” Reply to “interview” for full interview information Distributed storage system, which stores data in multiple independent devices. Traditional network storage system uses centralized storage server to store all data. Storage server becomes the bottleneck of system performance and the focus of reliability and security, which can not meet […]