1.

下载git源码

https://git-scm.com

2.

根据文档一步步操作

https://git-scm.com/book/en/v2/Getting-Started-Installing-Git

选择installing from source

sudo yum install dh-autoreconf libcurl4-gnutls-dev libexpat1-dev gettext libz-dev libssl-dev

sudo yum install asciidoc xmlto docbook2x

sudo yum install getopt

sudo ln -s /usr/bin/db2x_docbook2texi /usr/bin/docbook2x-texi

make configure

./configure --prefix=/usr

make all doc info

sudo make install install-doc install-html install-info

3.

上面 make all doc info的时候会报错,实际上我们只需make,然后makeinstall就可以了。如果你想安装其他的doc和info,那么就需要

http://docbook2x.sourceforge.net/

上面的 sudo ln -s /usr/bin/db2x_docbook2texi /usr/bin/docbook2x-texi是失败的,因为你根本没有db2x_docbook2texi

可以根据上面的官网源码安装,但是我试了最后,编译成功,还是无法使用

提示下面的错误

I/O error : Attempt to load network entity http://docbook2x.sf.net/latest/xslt/texi/docbook.xsl
warning: failed to load external entity "http://docbook2x.sf.net/latest/xslt/texi/docbook.xsl"
cannot parse http://docbook2x.sf.net/latest/xslt/texi/docbook.xsl
Unable to recognise encoding of this document at /usr/share/perl5/vendor_perl/XML/SAX/PurePerl/EncodingDetect.pm line .
Document requires an element [Ln: , Col: ]
make[]: *** [user-manual.texi] Error

所以呢,我们用现成编好的

参考 https://www.lovesofttech.com/git/centOS7Git/

按照作者的方式是可以直接编译过的

05-28 03:06