Centos7 isntall git

  1. 下载源码包(我的版本是git-2.11.0.tar.gz)

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

Centos7 isntall git_第1张图片
  1. 解压压缩包

# tar -xvf git-2.11.0.tar.gz

  1. 进入目录

# cd git-2.11.0

  1. 安装依赖包

# yum -y install curl-devel zlib-devel openssl-devel perl cpio expat-devel gettext-devel perl-ExtUtils-MakeMaker package asciidoc

  1. 删除旧的版本

# yum remove git

Centos7 isntall git_第2张图片
  1. 编译

    # make prefix=/usr/local/git all

  2. 安装:

# make prefix=/usr/local/git install

  1. 定义环境变量
  • root

# echo "export PATH=$PATH:/usr/local/git/bin" >> /etc/bashrc

  • 普通用户

$ echo "export PATH=$PATH:/usr/local/git/bin" >> ~/.bashrc

  1. git --version 后面出现如下所示

恭喜!你成功了!

你可能感兴趣的:(Centos7 isntall git)