編譯基礎環境環境
代碼如下 |
複製代碼 |
yum -y install gcc make
|
確保已安裝了依賴的包
代碼如下 |
複製代碼 |
yum install -y curl curl-devel zlib-devel openssl-devel perl perl-devel cpio expat-devel gettext-devel
|
下載最新的git包
代碼如下 |
複製代碼 |
wget http://www.codemonkey.org.uk/projects/git-snapshots/git/git-latest.tar.gz tar xzvf git-latest.tar.gz cd git-2012-07-05 #你的目錄可能不是這個 autoconf ./configure make && make install
|
檢查下安裝的版本,大功告成
代碼如下 |
複製代碼 |
[root@cobbler git-2012-07-05]# git --version git version 1.7.11.GIT
|
編譯時間遇到錯誤訊息及解決方案:
make[1]: Warning: File `Makefile' has modification time 3e+06 s in the future
/usr/bin/perl Makefile.PL PREFIX='/usr/local' INSTALL_BASE='' --localedir='/usr/local/share/locale'
Writing perl.mak for Git
make[1]: warning: Clock skew detected. Your build may be incomplete.
GEN git-add--interactive
make[1]: Warning: File `Makefile' has modification time 3e+06 s in the future
Writing perl.mak for Git
make[2]: Warning: File `Makefile.PL' has modification time 3e+06 s in the future
Use of uninitialized value $localedir in concatenation (.) or string at Makefile.PL line 52.
Writing perl.mak for Git
make[2]: *** [perl.mak] Error 1
make[1]: *** [instlibdir] Error 2
make: *** [git-add--interactive] Error 2
在網上搜尋了一些,根據出錯的warning發現是機器時間設定的問題。。是機器系統的時間比版本的時間早。所以要系統時間重新設定。
我自己使用的是centos6由於CentOS6中yum源中已經有git的版本了,可以直接使用yum源進行安裝
代碼如下 |
複製代碼 |
yum -y install git |
目前yum源中的git版本如下
代碼如下 |
複製代碼 |
[root@cobbler ~]# git --version git version 1.7.1 |
我在編譯安裝git時出現一個小問題,下面給大家貼出來供大家參考。
1.下載git版本
代碼如下 |
複製代碼 |
wget http://git-core.googlecode.com/files/git-1.7.10.1.tar.gz wget http://git-core.googlecode.com/files/git-manpages-1.7.10.1.tar.gz |
2.在make編譯git的時候報下面的錯誤:
make[1]: Warning: File `Makefile' has modification time 2.5e+07 s in the future
/usr/bin/perl Makefile.PL PREFIX='/usr/local'
Writing perl.mak for Git
make[1]: warning: Clock skew detected. Your build may be incomplete.
GEN git-add--interactive
make[1]: Warning: File `Makefile' has modification time 2.5e+07 s in the future
Writing perl.mak for Git
make[2]: Warning: File `Makefile.PL' has modification time 2.5e+07 s in the future
Writing perl.mak for Git
make[2]: *** [perl.mak] Error 1
make[1]: *** [instlibdir] Error 2
make: *** [git-add--interactive] Error 2
網上搜了下,根據出錯的warning發現是機器時間設定的問題,重新設定下機器時間就搞定了:
代碼如下 |
複製代碼 |
ntpdate time.nist.gov |
3.安裝完後,想使用線上協助報下面的錯:
代碼如下 |
複製代碼 |
[root@test ~]# man git No manual entry for git
|
解壓git-manpages-1.7.10.1.tar.gz到/usr/share/man目錄下就可以了.這個包是編譯好的,不是源碼的安裝包.
代碼如下 |
複製代碼 |
tar zxf git-manpages-1.7.10.1.tar.gz -C /usr/share/man
|
這樣就可以使用man git了.