新聞中心
VMware Workstation已經(jīng)采用最小化安裝centos7,顯示版本為CentOS7.5,準(zhǔn)備采用yum安裝git。采用yum list git發(fā)現(xiàn)可安裝的GIT軟件包版本1.8.3.1,新的版本已經(jīng)是2.19了,因此,我決定編譯安裝git2.19。

由于采用最小化安裝系統(tǒng),編譯時出現(xiàn)一些問題,這里對處理過程作一下備忘:
1、首先在git官網(wǎng)上下載最新的版本,下載地址:https://mirrors.edge.kernel.org/pub/software/scm/git/git-2.19.0.tar.gz
2、由于采用win10操作系統(tǒng)下載的文件,需要上傳到CentOS7上,操作方式我一般通過SecureCRT采用SSH2協(xié)議登錄,
上傳文件也通過SecureCRT工具中的SFTP協(xié)議,具體方法如圖:
注意:上傳的文件會在登錄用戶的home目錄下,可以通過lpwd查看本地目錄,pwd查看遠端目錄
3、對文件解壓:tar xzvf git-2.19.0.tar.gz
# make configure ;# as yourself
# ./configure --prefix=/usr ;# as yourself
# make all doc ;# as yourself
# make install install-doc install-html;# as root
5、首先執(zhí)行make configure,開始就出錯了,提示:
configure: Setting lib to 'lib' (the default)
configure: Will try -pthread then -lpthread to enable POSIX Threads.
configure: CHECKS for site configuration
checking for gcc... no
checking for cc... no
checking for cl.exe... no
configure: error: in `/opt/git-2.19.0':
configure: error: no acceptable C compiler found in $PATH
See `config.log' for more details
通過yum provides gcc和 yum provides cc查詢到c編譯器沒有安裝,yum -y install gcc安裝gcc包及對應(yīng)的依賴。
6、再次執(zhí)行make configure,再次出現(xiàn)如下錯誤:
GIT_VERSION = 2.19.0
GEN configure
/bin/sh: autoconf: 未找到命令
make: *** [configure] 錯誤 127
通過yum provides autoconf查詢到?jīng)]有安裝autoconf,yum -y install autoconf安裝包及對應(yīng)的依賴。
7、再一次執(zhí)行make configure,正常了,接下來 ./configure很順利。
8、執(zhí)行make all doc,又出現(xiàn)錯誤:
* new build flags
CC credential-store.o
In file included from credential-store.c:1:0:
cache.h:20:18: 致命錯誤:zlib.h:沒有那個文件或目錄
#include
^
編譯中斷。
make: *** [credential-store.o] 錯誤 1
錯誤指出沒有zlib,yum -y install zlib安裝,發(fā)現(xiàn)已經(jīng)安裝,zlib.h應(yīng)該是對應(yīng)的開發(fā)包沒有,yum -y install zlib-devel安裝開發(fā)包
9、再執(zhí)行make all doc,再出現(xiàn)錯誤:
/bin/sh:行1: asciidoc: 未找到命令
make[1]: *** [git-init-db.html] 錯誤 127
make[1]: 離開目錄“/opt/git-2.19.0/Documentation”
make: *** [doc] 錯誤 2
沒有asciidoc命令,yum list asciidoc發(fā)現(xiàn)包沒有安裝,yum -y install asciidoc安裝該包。
10、再一次執(zhí)行make all doc,仍出現(xiàn)錯誤:
/bin/sh:行1: xmlto: 未找到命令
make[1]: *** [git-init-db.1] 錯誤 127
make[1]: 離開目錄“/opt/git-2.19.0/Documentation”
make: *** [doc] 錯誤 2
思路一樣,沒有xmlto命令,yum list xmlto發(fā)現(xiàn)包沒有安裝, yum -y install xmlto安裝該包,執(zhí)行make all doc這下很順利。
11、執(zhí)行make install install-doc install-html,這下安裝很順利,沒有再提示錯誤。
12、測試一下,執(zhí)行g(shù)it --version正常顯示:
git version 2.19.0
終于安裝成功了,可以正常使用。
文章名稱:最小化安裝的CentOS7.5上編譯安裝Git2.19
轉(zhuǎn)載源于:http://fisionsoft.com.cn/article/cohgidp.html


咨詢
建站咨詢
