在linux系统上安装git,在Linux系统上安装Git

为了安装指定的版本的git,所以采用源码安装的方式。

我的linux系统版本信息如下:

[root@VM-0-2-centos git-2.30.0]# cat /proc/version

Linux version 3.10.0-862.el7.x86_64 (builder@kbuilder.dev.centos.org) (gcc version 4.8.5 20150623 (Red Hat 4.8.5-28) (GCC) ) #1 SMP Fri Apr 20 16:44:24 UTC 2018

卸载之前的版本

yum -y remove git

下载包到指定目录,然后解压

#下载位置(自己随意)

[root@VM-0-2-centos tools]# ls

git-2.30.0.tar.gz

#解压包

[root@VM-0-2-centos tools]# tar -zxvf git-2.30.0.tar.gz

#解压后

[root@VM-0-2-centos tools]# ls

git-2.30.0 git-2.30.0.tar.gz

#进入

[root@VM-0-2-centos tools]# cd git-2.30.0/

安装源码之前,需要安装一些依赖

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

编译git源码

make prefix=/usr/local/git all

安装git到/usr/local/git

make prefix=/usr/local/git install

配置环境变量

vim /etc/profile

#在底部添加 export PATH=$PATH:/usr/local/git/bin

#使环境变量生效

soruce /etc/profile

产看是否安装成功

[root@VM-0-2-centos git-2.30.0]# git --version

git version 1.8.3.1

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值