CentOS 7 安裝 git

參考資料:
CentOS7安裝Git以及操作
error: zlib.h: No such file or directory


一:安裝包下載并解壓

1、官網(wǎng)下載地址:https://mirrors.edge.kernel.org/pub/software/scm/git/


2、也可以直接在CentOS中直接下載:

[root@yanze-1 local]# pwd
/usr/local
[root@yanze-1 local]# 
[root@yanze-1 local]# wget https://mirrors.edge.kernel.org/pub/software/scm/git/git-2.9.0.tar.gz

3、執(zhí)行命令進(jìn)行解壓

[root@yanze-1 local]# tar -zxvf git-2.9.0.tar.gz
[root@yanze-1 local]#
二、編譯并安裝

1、進(jìn)目錄

[root@yanze-1 local]# cd git-2.9.0
[root@yanze-1 git-2.9.0]# ./configure --prefix=/usr/local/git-2.9.0
[root@yanze-1 git-2.9.0]# make

2、執(zhí)行make后出錯(cuò),提示zlib.h不存在,如下圖:



3、需要安裝zlib

[root@yanze-1 git-2.9.0]# yum install zlib-devel
<!-- 安裝完zlib后,再執(zhí)行make,等待編譯完成-->

4、結(jié)果后面又報(bào)錯(cuò):compilation aborted at Makefile.PL line 3.,執(zhí)行如下命令:

 yum install perl-ExtUtils-CBuilder perl-ExtUtils-MakeMaker
<!-- 執(zhí)行完后,再執(zhí)行make,等待編譯完成-->

5、等待上面安裝完成后,執(zhí)行最后一步

[root@yanze-1 git-2.9.0]# make install
<!-- 稍等片刻后-->
[root@yanze-1 git-2.9.0]#  git --version
git version 2.9.0
<!-- git 完成安裝-->
[root@yanze-1 git-2.9.0]#  

6、至此,git安裝完成

最后編輯于
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請(qǐng)聯(lián)系作者
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時(shí)請(qǐng)結(jié)合常識(shí)與多方信息審慎甄別。
平臺(tái)聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點(diǎn),簡(jiǎn)書系信息發(fā)布平臺(tái),僅提供信息存儲(chǔ)服務(wù)。

相關(guān)閱讀更多精彩內(nèi)容

友情鏈接更多精彩內(nèi)容