Thursday, February 7, 2013

CentOS6にGitをインストールする方法

yumでインストールできなかったので、ソースからインストールしてみます。
# yum install git
Loaded plugins: fastestmirror, presto
Loading mirror speeds from cached hostfile
 * base: www.ftp.ne.jp
 * epel: ftp.jaist.ac.jp
 * extras: www.ftp.ne.jp
 * rpmforge: mirror.hmc.edu
 * updates: mirrors.neusoft.edu.cn
Setting up Install Process
Resolving Dependencies
--> Running transaction check
---> Package git.i386 0:1.7.11.3-1.el5.rf will be installed
--> Processing Dependency: perl-Git = 1.7.11.3-1.el5.rf for package: git-1.7.11.3-1.el5.rf.i386
--> Processing Dependency: libcurl.so.3 for package: git-1.7.11.3-1.el5.rf.i386
--> Processing Dependency: rsync for package: git-1.7.11.3-1.el5.rf.i386
--> Processing Dependency: libexpat.so.0 for package: git-1.7.11.3-1.el5.rf.i386
--> Processing Dependency: perl(Git) for package: git-1.7.11.3-1.el5.rf.i386
--> Running transaction check
---> Package compat-expat1.i686 0:1.95.8-8.el6 will be installed
---> Package git.i386 0:1.7.11.3-1.el5.rf will be installed
--> Processing Dependency: libcurl.so.3 for package: git-1.7.11.3-1.el5.rf.i386
---> Package perl-Git.i386 0:1.7.11.3-1.el5.rf will be installed
--> Processing Dependency: perl(SVN::Ra) for package: perl-Git-1.7.11.3-1.el5.rf.i386
--> Processing Dependency: perl(SVN::Delta) for package: perl-Git-1.7.11.3-1.el5.rf.i386
--> Processing Dependency: perl(SVN::Client) for package: perl-Git-1.7.11.3-1.el5.rf.i386
--> Processing Dependency: perl(YAML::Any) for package: perl-Git-1.7.11.3-1.el5.rf.i386
--> Processing Dependency: perl(SVN::Core) for package: perl-Git-1.7.11.3-1.el5.rf.i386
---> Package rsync.i686 0:3.0.6-9.el6 will be installed
--> Running transaction check
---> Package git.i386 0:1.7.11.3-1.el5.rf will be installed
--> Processing Dependency: libcurl.so.3 for package: git-1.7.11.3-1.el5.rf.i386
---> Package perl-YAML.noarch 0:0.72-1.el5.rf will be installed
---> Package subversion-perl.i686 0:1.6.11-7.el6 will be installed
--> Finished Dependency Resolution
Error: Package: git-1.7.11.3-1.el5.rf.i386 (rpmforge)
           Requires: libcurl.so.3
 You could try using --skip-broken to work around the problem
 You could try running: rpm -Va --nofiles --nodigest
このように、yumでGitをインストールしようとすると、依存関係のエラーが出てインストール出来ません・・・。
諦めて、ソースからGitをインストールしました。
# cat /etc/redhat-release 
CentOS release 6.3 (Final)

# yum install gcc curl-devel expat-devel gettext-devel openssl-devel zlib-devel perl-ExtUtils-MakeMaker

# wget http://git-core.googlecode.com/files/git-1.8.1.2.tar.gz
# tar zxvf git-1.8.1.2.tar.gz
# cd git-1.8.1.2

# make configure
# ./configure --prefix=/usr
# make install

# git --version
git version 1.8.1.2
簡単ですね。