LoginSignup
38
30

More than 5 years have passed since last update.

gitをソースコードから入れる

Last updated at Posted at 2014-12-11

環境

CentOS release 6.4 (Final)

経緯

  1. yumで入れられるgitが1.7.1までだった(2014/12/11現在)
  2. ius、wandiscoのrpm使ってもうまく入らない...
  3. やむなし...ソースコードからやるか...

手順

# yum install curl-devel expat-devel gettext-devel openssl-devel zlib-devel
# wget https://www.kernel.org/pub/software/scm/git/git-2.2.0.tar.gz
# cd git-2.2.0
# ./configure
# make
# make install
# git --version
git version 2.2.0

最初に、必要なパッケージを入れておかないと、make時にエラーが出てくれるパッケージもあるが、
インストールしてから動かないということ(下記その5)も起きるので注意

この手順に至るまでの、今回起こったエラー対処

その1:Makefile.PLを書くのに必要なモジュールがない

# make

...省略...

    SUBDIR perl
/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] エラー 2
make: *** [perl/perl.mak] エラー 2
# yum install perl-ExtUtils-MakeMaker

その2:ツール操作言語が最適化されてない

# make

...省略...

    SUBDIR git-gui
GITGUI_VERSION = 0.19.0.2.g3decb8e
    * new locations or Tcl/Tk interpreter
    GEN git-gui
    INDEX lib/
    * tclsh failed; using unoptimized loading
    MSGFMT    po/bg.msg make[1]: *** [po/bg.msg] エラー 127
make: *** [all] エラー 2
# yum install tcl*.x86_64

その3: msgfmtがない

# make

...省略...

Manifying blib/man3/Git.3pm
    SUBDIR templates
    MSGFMT po/build/locale/bg/LC_MESSAGES/git.mo
/bin/sh: msgfmt: コマンドが見つかりません
make: *** [po/build/locale/bg/LC_MESSAGES/git.mo] エラー 127

(ここで何故か)

# yum install expat-devel

その4:だからmsgfmtがないんだって

# make

...省略...

/usr/bin/perl -pe "s<\Q++LOCALEDIR++\E></usr/local/share/locale>" <Git.pm >blib/lib/Git.pm
    SUBDIR templates
    MSGFMT po/build/locale/bg/LC_MESSAGES/git.mo
/bin/sh: msgfmt: コマンドが見つかりません
make: *** [po/build/locale/bg/LC_MESSAGES/git.mo] エラー 127

msgfmtが入ってるgettextをインストール
(公式ではgettext-develと書いてありましたのでそちらがオススメかと)

# yum install gettext

その5:クローンできない()

# git clone https://gist.github.com/abcdefghijkmnlopqrst.git
Cloning into 'abcdefghijkmnlopqrst'...
fatal: Unable to find remote helper for 'https'

curl-develが入ってないことが原因。
アンインストールして、コンパイルからやりなおし...

# make uninstall
make: *** ターゲット `uninstall' を make するルールがありません.  中止.

# cat Makefile | grep uninstall
#

なるほど、つんだ。

アンインストールする手順を、別に書きました。
http://qiita.com/soeda_jp/items/fd7602ecf95db656cb05

参考

最新のバージョンのGitをソースコードからインストールする

CentOS6.5にGitをソースコードからインストールする

VPS 鯖に git いれたよ

CentOS 6.3にGit1.8.1をインストール

git clone https:/~ でfatal: Unable to find remote helper for 'https'が出たとき

Git - Gitのインストール

38
30
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
38
30