Centos7 从 git version 1.8.3.1升级git version 2.32.0 全过程

2021/8/13 7:06:08

本文主要是介绍Centos7 从 git version 1.8.3.1升级git version 2.32.0 全过程,对大家解决编程问题具有一定的参考价值,需要的程序猿们随着小编来一起学习吧!

安装安装依赖软件

[root@localhost ~]# yum install curl-devel expat-devel gettext-devel openssl-devel zlib-devel asciidoc
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
* base: mirrors.163.com

================================================
============省略一大堆不需要操作的过程=============
================================================

Installed:
gettext-devel.x86_64 0:0.19.8.1-3.el7

Complete!
[root@localhost ~]# yum install gcc perl-ExtUtils-MakeMaker
================================================
============省略一大堆不需要操作的过程=============
================================================

卸载之前安装的版本


[root@localhost ~]# git --version
git version 1.8.3.1
[root@localhost ~]# yum remove git
Loaded plugins: fastestmirror
Resolving Dependencies
================================================
============省略一大堆不需要操作的过程=============
================================================

 

下载软件


[root@localhost ~]# cd /usr/local/src/
[root@localhost src]# wget https://mirrors.edge.kernel.org/pub/software/scm/git/git-2.32.0.tar.xz
--2021-08-12 09:37:01-- https://mirrors.edge.kernel.org/pub/software/scm/git/git-2.32.0.tar.xz
Resolving mirrors.edge.kernel.org (mirrors.edge.kernel.org)... 147.75.95.133, 2604:1380:3000:1500::1
Connecting to mirrors.edge.kernel.org (mirrors.edge.kernel.org)|147.75.95.133|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 6551348 (6.2M) [application/x-xz]
Saving to: ‘git-2.32.0.tar.xz’

100%[===========================================================================================>] 6,551,348 55.4KB/s in 1m 46s

2021-08-12 09:38:49 (60.3 KB/s) - ‘git-2.32.0.tar.xz’ saved [6551348/6551348]
[root@localhost src]# ls
git-2.32.0.tar.xz
[root@localhost src]# tar -xf git-2.32.0.tar.xz
[root@localhost src]# cd git-2.32.0/
[root@localhost git-2.32.0]# make prefix=/usr/local/git all
[root@localhost git-2.32.0]# make prefix=/usr/local/git install
[root@localhost git-2.32.0]# echo "export PATH=$PATH:/usr/local/git/bin" >> /etc/profile
[root@localhost git-2.32.0]# source /etc/profile
[root@localhost git-2.32.0]# git --version
git version 2.32.0

如果只是希望当前账户使用该版本则做如下操作


[root@localhost git-2.32.0]# echo "export PATH=$PATH:/usr/local/git/bin" >> ~/.bashrc
[root@localhost git-2.32.0]# source ~/.bashrc
[root@localhost git-2.32.0]# git --version
git version 2.32.0



这篇关于Centos7 从 git version 1.8.3.1升级git version 2.32.0 全过程的文章就介绍到这儿,希望我们推荐的文章对大家有所帮助,也希望大家多多支持为之网!


扫一扫关注最新编程教程