Linux环境git 安装

a.安装依赖包

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

b.下载源码包

wget https://www.kernel.org/pub/software/scm/git/git-2.16.1.tar.gz

c.解压源码包,并进入解压目录

tar -zxvf git-2.16.1.tar.gz
cd git-2.16.1

d.指定安装目录为/usr/local/git-2.16.1 并执行安装命令

./configure --prefix=/usr/local/git-2.16.1 && make && make install

e.设置全局环境变量,修改/etc/profile 并使修改生效

 vi /etc/profile
#GIT配置
export GIT_HOME=/usr/local/git-2.16.1
export PATH=$PATH:$GIT_HOME/bin:$JAVA_HOME/bin:$JRE_HOME/bin:$MAVEN_HOME/bin:$MYSQL_HOME/bin:$MYSQL_HOME/lib
source /etc/profile

f.查看git版,可以看到成功了

git --version
git version 2.16.1

你可能感兴趣的:(Linux环境git 安装)