CentOS上安裝Git與編譯安裝git出錯

來源:互聯網
上載者:User

編譯基礎環境環境

 代碼如下 複製代碼
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了.

相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.