/dev/null

(◞‸◟)

CentOS 6.4にgitの最新版をソースから入れる

VPSで遊んでるので備忘録

そもそもCentOS にデフォルトでgit入ってるっぽい

[user@host ~]$ /usr/bin/git --version

[user@host ~]$git version 1.7.1

だが1.7。

何が違うかわからんが新しいの入れよう。

まずソースを持ってきます。

https://code.google.com/p/git-core/downloads/list?can=1&q= にアクセス

最新バージョンのurlを見つけて

https://git-core.googlecode.com/files/git-1.8.3.2.tar.gz

wget

[user@host ~]$ wget https://git-core.googlecode.com/files/git-1.8.3.2.tar.gz

しばし待ったら解凍

tar zvxf git-1.8.3.2.tar.gz

解凍出来たら移動する

[user@host ~]$ cd git-1.8.3.2

ここまではまあだれでも出来そう。

んでこっからinstall

今回は/usr/local/binに入れます

伝統のconfigure

[user@host git-1.8.3.2]$ ./configure --prefix=/usr/local/

でmake

[user@host git-1.8.3.2]$ make

が、エラーだ

GIT_VERSION = 1.8.3.2
    * new build flags
    CC credential-store.o
In file included from credential-store.c:1:
cache.h:19:18: warning: zlib.h: No such file or directory
In file included from credential-store.c:1:
cache.h:21: error: expected specifier-qualifier-list before 'z_stream'
make: *** [credential-store.o] Error 1

zlibがないのでinstall

[user@host git-1.8.3.2]$ sudo yum install zlib-devel

もう一度make

が、またエラー

/usr/bin/perl Makefile.PL PREFIX='/usr/local' INSTALL_BASE='' --localedir='/usr/local/share/locale'
Can't locate ExtUtils/MakeMaker.pm in @INC (@INC contains: /usr/local/lib64/perl5 /usr/local/share/perl5 /usr/lib64/perl5/vendor_perl /usr/share/perl5/vendor_perl /usr/lib64/perl5 /usr/share/perl5 .) at Makefile.PL line 3.
BEGIN failed--compilation aborted at Makefile.PL line 3.
make[1]: *** [perl.mak] Error 2
make: *** [perl/perl.mak] Error 2

ExtUtils/MakeMakerとかいうのがないのでインストール

[user@host git-1.8.3.2]$ sudo yum install perl-ExtUtils-MakeMaker

三度目のmake

通ります

[user@host git-1.8.3.2]$ make

...

GEN bin-wrappers/test-wildmatch

お待ちかねmake install

[user@host git-1.8.3.2]$ make install

...

多分インストール出来ました

[user@host ~]$ which git
/usr/local/bin/git

[user@host~]$ git --version
git version  1.8.3.2

幸福がもたらされました