Centos7下git安装

为什么要安装git

Linux默认安装的git版本比较低,所以需要安装教新版的git

安装wget,并下载git

[root@localhost softwares]# yum install -y wget
[root@localhost softwares]# wget https://mirrors.edge.kernel.org/pub/software/scm/git/git-2.31.0.tar.gz
[root@localhost softwares]# ll
总用量 329716
-rw-r--r--. 1 root root 327497331 3月  25 13:13 elasticsearch-7.12.0-linux-x86_64.tar.gz
-rw-r--r--. 1 root root  10129349 3月  16 03:29 git-2.31.0.tar.gz
[root@localhost softwares]#

解压git到/usr/local/下

[root@localhost softwares]# tar -zxvf git-2.31.0.tar.gz -C /usr/local/

安装依赖

[root@localhost softwares]# yum install curl-devel expat-devel gettext-devel openssl-devel zlib-devel gcc perl-ExtUtils-MakeMaker

进入/usr/local/git-2.31.0

[root@localhost local]# cd git-2.31.0

编译

[root@localhost git-2.31.0]# make prefix=/data/install/git all

安装

[root@localhost git-2.31.0]# make prefix=/data/install/git install

修改环境变量

path中增加git路径 export PATH= J A V A H O M E / b i n : / d a t a / i n s t a l l / g i t / b i n : JAVA_HOME/bin:/data/install/git/bin: JAVAHOME/bin:/data/install/git/bin:PATH

[root@localhost git-2.31.0]# vim /etc/profile

在这里插入图片描述

刷新,使配置生效

[root@localhost git-2.31.0]# source /etc/profile

查看git版本

[root@localhost git-2.31.0]# git --version
git version 2.31.0
  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值