1. 程式人生 > >linux編譯安裝git

linux編譯安裝git

本文講述linux下編譯安裝git的過程。 
參考內容

一、下載原始碼

https://www.kernel.org/pub/software/scm/git/ 
在該網址下載你所需版本的git原始碼,如 
$ wget https://www.kernel.org/pub/software/scm/git/git-1.9.5.tar.gz

二、安裝所需工具

$ sudo yum install curl-devel expat-devel gettext-devel \ 
openssl-devel zlib-devel
或 
$ sudo apt-get install libcurl4-gnutls-dev libexpat1-dev gettext \ 
libz-dev libssl-dev

三、編譯安裝

$ tar -zxf git-1.9.5.tar.gz 
$ cd git-1.9.5 
$ ./configure --prefix=/usr 
$ make 
$ sudo make install

四、設定環境變數

在主目錄的.bash_profile或者/etc/profile檔案加入設定環境變數 
export PATH=/usr/libexec/git-core:$PATH

然後重啟登入或者source一下該檔案使其生效。

CentOS6.3編譯安裝安裝git2.3.4提示:

Can't locate ExtUtils/MakeMaker.pm in @INC

解決:

yum install perl-ExtUtils-CBuilder perl-ExtUtils-MakeMaker