centos7卸载自带git升级到最新版git记录

星期三, 2019-05-15 | Author: Lee | linux | 2,005 views

git版本升级到高版本(git-2.21.0)。下面说下git升级的操作记录

[root@IA ~]# git --version
git version 1.8.3

0)安装依赖软件

[root@IA ~]# yum install curl-devel expat-devel gettext-devel openssl-devel zlib-devel asciidoc
 
[root@IA ~]# yum install  gcc perl-ExtUtils-MakeMaker

1)卸载系统自带的底版本git(1.8.3)

[root@IA ~]# git --version
git version 1.8.3
 
[root@IA ~]# yum remove git

2)编译安装最新的git版本

[root@IA ~]# cd /usr/local/src/
 
[root@IA src]# wget https://mirrors.edge.kernel.org/pub/software/scm/git/git-2.21.0.tar.xz
 
[root@IA src]# tar -vxf git-2.21.0.tar.xz
 
[root@IA src]# cd git-2.21.0
 
[root@IA git-2.21.0]# make prefix=/usr/local/git all
 
[root@IA git-2.21.0]# make prefix=/usr/local/git install
 
[root@IA git-2.21.0]# echo "export PATH=$PATH:/usr/local/git/bin" >> /etc/profile
 
[root@IA git-2.21.0]# source /etc/profile
 
[root@IA ~]# git --version
git version 2.21.0

如果是非root用户使用git,则需要配置下该用户下的环境变量

[app@IA ~]$ echo "export PATH=$PATH:/usr/local/git/bin" >> ~/.bashrc
 
[app@IA ~]$ source ~/.bashrc
[app@IA ~]$ git --version
git version 2.21.0

Tags:

文章作者: Lee

本文地址: https://www.pomelolee.com/1875.html

除非注明,Pomelo Lee文章均为原创,转载请以链接形式标明本文地址

No comments yet.

Leave a comment

Search

文章分类

Links

Meta