CentOS7.5 安装git-2.37.3

1.安装依赖库

yum install -y curl-devel expat-devel gettext-devel openssl-devel zlib-devel gcc-c++ perl-ExtUtils-MakeMaker autoconf

2.移除默认安装的旧版git

yum remove git
rm -f /usr/bin/git

3.下载源码

[root@localhost ~]# mkdir /opt/git && cd /opt/git # 创建目录
[root@localhost /opt/git]# curl https://mirrors.edge.kernel.org/pub/software/scm/git/git-2.37.3.tar.gz -O /opt/git/git-2.37.3.tar.gz # 下载源码
[root@localhost /opt/git]# tar xf git-2.37.3.tar.gz # 解压文件

4.配置编译安装

[root@localhost git-2.37.3]# cd /opt/git/git-2.37.3
[root@localhost git-2.37.3]# make configure
##配置目录
[root@localhost git-2.37.3]# ./configure --prefix=/opt/git/git-2.37.3 
[root@localhost git-2.37.3]# make profix=/opt/git/git-2.37.3
[root@localhost git-2.37.3]# make install

5.配置环境变量

[root@localhost git-2.37.3]# ln -s /opt/git/git-2.37.3/bin/git /usr/bin/git
[root@localhost git-2.37.3]# echo "export PATH=$PATH:/opt/git/git-2.37.3/bin" >> /etc/profile 
[root@localhost git-2.37.3]# source /etc/profile
[root@localhost git-2.37.3]# git --version

6.检查版本

[root@localhost example]# git --version
git version 2.37.3
[root@localhost example]#

CentOS7.5 安装git-2.37.3
https://www.gmtgo.com/159.html
作者
大帅
发布于
2022年9月27日
许可协议