CentOS 6 上通过 yum 安装的是 git 1.x 版本, 本文将讲述如何在 CentOS 6 上编译安装 git 2.x 。下面是详细步骤:
-
安装编译所需的环境依赖
sudo yum -y install wget curl-devel expat-devel gettext-devel openssl-devel zlib-devel perl-ExtUtils-MakeMaker gcc asciidoc xmlto docbook2x # 解决编译时出现的 /bin/sh: line 1: docbook2x-texi: command not found ln -s /usr/bin/db2x_docbook2texi /usr/bin/docbook2x-texi
-
下载 git 2.x 源码包
cd /tmp wget https://www.kernel.org/pub/software/scm/git/git-2.5.0.tar.gz
-
解压,编译,安装
cd /tmp tar zxvf git-2.5.0.tar.gz cd git-2.5.0/ make configure ./configure --prefix=/usr/local make all doc info make install install-doc install-html install-info
-
配置
PATH
环境变量echo 'export PATH=/usr/local/bin:$PATH' >> ~/.bashrc source ~/.bashrc
-
;)
$ git --version git version 2.5.0
Comments