参考文献: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]#