先下载 wget https://mirrors.edge.kernel.org/pub/software/scm/git/git-2.9.5.tar.gz
解压文件 tar -zxf git-2.9.5.tar.gz
进入git文件夹 cd git-2.9.5
通过源代码编译安装测试 make configure
提示 /bin/sh: autoconf: command not found
错误
[root@master git-2.9.5]# make configure
GIT_VERSION = 2.9.5
GEN configure
/bin/sh: autoconf: command not found
make: *** [configure] Error 127
解决方案:执行 yum install install autoconf automake libtool -y
再执行 make configure
[root@master git-2.9.5]# make configure
GEN configure
执行指定位置安装 ./configure --prefix=/usr
# 最后三行显示此结果,表示安装成功
configure: creating ./config.status
config.status: creating config.mak.autogen
config.status: executing config.mak.autogen commands
执行 make all doc info
出现下面错误
[root@master git-2.9.5]# make all doc info
* new build flags
CC credential-store.o
In file included from credential-store.c:1:0:
cache.h:40:18: fatal error: zlib.h: No such file or directory
#include <zlib.h>
^
compilation terminated.
make: *** [credential-store.o] Error 1
解决方案:安装 yum install zlib zlib-devel -y
再次执行 make all doc info
出现 perl 错误
/usr/bin/perl Makefile.PL PREFIX='/usr/share/locale' INSTALL_BASE='' --localedir='/usr/share/locale/share/locale'
Can't locate ExtUtils/MakeMaker.pm in @INC (@INC contains: /usr/local/lib64/perl5 /usr/local/share/perl5 /usr/lib64/perl5/vendor_perl /usr/share/perl5/vendor_perl /usr/lib64/perl5 /usr/share/perl5 .) at Makefile.PL line 3.
BEGIN failed--compilation aborted at Makefile.PL line 3.
make[1]: *** [perl.mak] Error 2
make: *** [perl/perl.mak] Error 2
解决方案:执行 yum -y install perl-devel
再次执行 make all doc info
出现 /bin/sh: line 1: asciidoc: command not found
错误
make -C Documentation all
make[1]: Entering directory `/root/git-2.9.5/Documentation'
GEN mergetools-list.made
GEN cmd-list.made
GEN doc.dep
make[2]: Entering directory `/root/git-2.9.5'
make[2]: `GIT-VERSION-FILE' is up to date.
make[2]: Leaving directory `/root/git-2.9.5'
make[1]: Leaving directory `/root/git-2.9.5/Documentation'
make[1]: Entering directory `/root/git-2.9.5/Documentation'
make[2]: Entering directory `/root/git-2.9.5'
make[2]: `GIT-VERSION-FILE' is up to date.
make[2]: Leaving directory `/root/git-2.9.5'
ASCIIDOC git-help.html
/bin/sh: line 1: asciidoc: command not found
make[1]: *** [git-help.html] Error 127
make[1]: Leaving directory `/root/git-2.9.5/Documentation'
make: *** [doc] Error 2
解决方案:安装 yum install asciidoc -y
再次执行 make all doc info
出现 /bin/sh: line 1: xmlto: command not found
错误
sed "s|@@MAN_BASE_URL@@|file:///usr/share/locale/share/doc/git/|" manpage-base-url.xsl.in > manpage-base-url.xsl
XMLTO git-help.1
/bin/sh: line 1: xmlto: command not found
make[1]: *** [git-help.1] Error 127
make[1]: Leaving directory `/root/git-2.9.5/Documentation'
make: *** [doc] Error 2
解决方案:执行 yum install xmlto -y
再次执行make all doc info
提示错误 /bin/sh: line 1: docbook2x-texi: command not found
make[1]: Leaving directory `/root/git-2.9.5/Documentation'
make -C Documentation info
make[1]: Entering directory `/root/git-2.9.5/Documentation'
make[2]: Entering directory `/root/git-2.9.5'
make[2]: `GIT-VERSION-FILE' is up to date.
make[2]: Leaving directory `/root/git-2.9.5'
DB2TEXI user-manual.texi
/bin/sh: line 1: docbook2x-texi: command not found
make[1]: *** [user-manual.texi] Error 127
make[1]: Leaving directory
解决方案:
wget http://dl.fedoraproject.org/pub/epel/7/x86_64/Packages/d/docbook2X-0.8.8-17.el7.x86_64.rpm
yum install sgml2xml openjdade perl texinfo -y
cd /usr/bin/
ln -s db2x_docbook2texi docbook2x-texi
cd /root/git-2.9.5
再执行 make all doc info
成功完成
[root@master git-2.9.5]# make all doc info
SUBDIR git-gui
SUBDIR gitk-git
SUBDIR perl
SUBDIR templates
make -C Documentation all
make[1]: Entering directory `/root/git-2.9.5/Documentation'
make[2]: Entering directory `/root/git-2.9.5'
make[2]: `GIT-VERSION-FILE' is up to date.
make[2]: Leaving directory `/root/git-2.9.5'
make[1]: Nothing to be done for `all'.
make[1]: Leaving directory `/root/git-2.9.5/Documentation'
make -C Documentation info
make[1]: Entering directory `/root/git-2.9.5/Documentation'
make[2]: Entering directory `/root/git-2.9.5'
make[2]: `GIT-VERSION-FILE' is up to date.
make[2]: Leaving directory `/root/git-2.9.5'
make[1]: Nothing to be done for `info'.
make[1]: Leaving directory `/root/git-2.9.5/Documentation'
安装 sudo make install install-doc install-html install-info
configure: creating ./config.status
config.status: creating config.mak.autogen
config.status: executing config.mak.autogen commands
查看版本说明安装成功
[root@master ~]# git --version
git version 2.9.5
总结快速安装代码
wget https://mirrors.edge.kernel.org/pub/software/scm/git/git-2.9.5.tar.gz
tar -zxf git-2.9.5.tar.gz
cd git-2.9.5
yum install install autoconf automake libtool -y
./configure --prefix=/usr
yum install zlib zlib-devel perl-devel asciidoc xmlto -y
wget http://dl.fedoraproject.org/pub/epel/7/x86_64/Packages/d/docbook2X-0.8.8-17.el7.x86_64.rpm
yum install sgml2xml openjdade perl texinfo -y
cd /usr/bin/
ln -s db2x_docbook2texi docbook2x-texi
cd /root/git-2.9.5
make all doc info
sudo make install install-doc install-html install-info
Git Clone ... 执行提示 git fatal: Unable to find remote helper for 'https'
错误
解决方案:
wget https://curl.se/download/curl-7.81.0.tar.gz
tar -zxf curl-7.81.0.tar.gz
cd curl-7.81.0
./configure --prefix=/usr --without-ssl
cd ../git-2.9.5
./configure --prefix=/usr --with-curl=/usr
make && make install
网友评论