Home  >  Article  >  Operation and Maintenance  >  Detailed explanation of how to install git on centos

Detailed explanation of how to install git on centos

藏色散人
藏色散人forward
2021-06-03 15:43:506426browse

The following tutorial column will introduce you to centos installation git from centos. I hope it will be helpful to friends who need it!

Detailed explanation of how to install git on centos

View the git version of the default yum source

# 安装
yum install -y git

# 查看版本
git version

# git version 1.8.3.1

Please refer to the official website, there are two ways to install the new version on CentOS

One , Compile method installation

1. Download the latest version source code
mirrors.edge.kernel.org/pub/softwa...

yum install -y wget

wget -O /tmp/git-2.21.0.tar.gz https://mirrors.edge.kernel.org/pub/software/scm/git/git-2.21.0.tar.gz

2. Unzip and compile

# 安装编译依赖
yum install -y curl-devel expat-devel gettext-devel openssl-devel zlib-devel gcc perl-ExtUtils-MakeMaker

# 解压
tar -zxf /tmp/git-2.21.0.tar.gz -C /tmp/cd /tmp/git-2.21.0# 检验相关依赖,设置安装路径./configure --prefix=/usr/local/git

# 编译安装
make && make install

3. Configure global environment variables

# 删除已有的 git
yum remove git

# 配置环境变量
vim /etc/profile

# 将下面这段话写入到文件最下面
# GIT_HOMEGIT_HOME=/usr/local/gitexport PATH=$PATH:$GIT_HOME/bin

# 刷新
source /etc/profile

# 查看git版本[root@iZm5e2yjivclstt1ylroeuZ git-2.9.5]# git --version
git version 2.9.5

The above is the detailed content of Detailed explanation of how to install git on centos. For more information, please follow other related articles on the PHP Chinese website!

Statement:
This article is reproduced at:learnku.com. If there is any infringement, please contact admin@php.cn delete