yum安装的方式不说了,网上很多。git源码安装有一堆的坑,主要是缺少依赖包,而且不同环境安装时出现的错误不一样,以下是我安装时碰到的问题和解决方法。
1. 通过官网下载最新的稳定包 https://github.com/git/git/tags,我用的是https://github.com/git/git/archive/v2.14.2.tar.gz
2. 解压
tar -zxvf v2.14.2.tar.gz
3. 安装
make configure ./configure \ --prefix=/usr/local/git \ --with-libpcre \ --with-iconv=/usr/local/libiconv\ --with-zlib=/usr/local/zlib make all doc info make install install-doc install-html install-info
4.添加环境变量
vi /etc/profile # set GIT environment export GIT_HOME=/usr/local/git export PATH=$GIT_HOME/bin:$PATH . /etc/profile
5. 执行 git version查看安装情况
安装过程中出现的错误:
/bin/sh: line 1: asciidoc: command not found
这个包可以到这里下载并执行make(./configure ;make ;make install)常用方法安装http://sourceforge.net/projects/asciidoc
***.xsl:1: parser error : Start tag expected, '<' not found
yum install docbook-style-xsl docbook-dtds
/bin/sh: line 1: xmlto: command not found
yum install xmlto
/bin/sh: line 1: docbook2x-texi: command not found
这个问题比较坑,刚开始安装了docbook2X还是没解决,所以又执行了下面的rpm安装及ln连接才解决
yum install docbook2X
wget ftp://ftp.is.co.za/mirror/fedora.redhat.com/epel/6/x86_64/docbook2X-0.8.8-1.el6.x86_64.rpm
rpm -ivh docbook2X-0.8.8-1.el6.x86_64.rpm
find / -name docbook2x-texi
find / -name db2x_docbook2texi
ln -s /usr/bin/db2x_docbook2texi /usr/bin/docbook2x-texi