【运维笔记】CentOS7.5 安装git-2.8.3

本文档介绍了如何在CentOS系统中通过yum命令安装和升级Git。首先,查看并安装必要的依赖库,然后卸载旧版本的Git,接着下载最新版本的Git源码并进行编译安装。最后,将Git添加到环境变量并验证安装成功。
摘要由CSDN通过智能技术生成

参考文献:https://www.cnblogs.com/songbao/p/12532113.html

一、yum安装git

命令:

[root@localhost /]# yum install git

1、查看yum源仓库Git信息:

[root@localhost /]# yum info git

2、安装依赖库:

[root@localhost /]# yum install curl-devel expat-devel gettext-devel openssl-devel zlib-devel
[root@localhost /]# yum install gcc-c++ perl-ExtUtils-MakeMaker
[root@localhost /]# yum -y install autoconf

3、如果原有的git版本过低,移除默认安装的旧版git:

[root@localhost /]# git --version
git version 2.8.3
[root@localhost /]# yum remove git 	## 移除原来的版本

4、下载安装:

[root@localhost /]# mkdir /opt/git
[root@localhost /]# cd /opt/git/
[root@localhost git]# wget --no-check-certificate https://www.kernel.org/pub/software/scm/git/git-2.8.3.tar.gz 

5、解压文件:

6、配置编译安装:

[root@localhost /]# mkdir /opt/git
[root@localhost /]# cd /opt/git/
[root@localhost git]# ls
git-2.18.0.tar.gz
[root@localhost git]# tar xf git-2.8.3.tar.gz
[root@localhost git]# cd git-2.8.3
[root@localhost git-2.8.3]# 
[root@localhost git-2.8.3]# make configure
[root@localhost git-2.8.3]# ./configure --prefix=/opt/git/git-2.8.3 ##配置目录
[root@localhost git-2.8.3]# make profix=/opt/git/git-2.8.3
[root@localhost git-2.8.3]# make install

7、加入环境变量:

[root@localhost git-2.8.3]# echo "export PATH=$PATH:/opt/git/git-2.8.3/bin" >> /etc/profile 

8、刷新环境变量:
``

[root@localhostgit-2.18.0]# source /etc/profile

9、检查版本:

[root@localhost back_code]# git --version
git version 2.8.3
[root@localhost back_code]# 
  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值