CentOS5.1にGitをインストールする
CentOSが5.1でもGitは使いたい。
※1年くらい前の作業メモなので今でもこの通りいくか不明。
※自己責任で試しましょう。
参考にさせていただいた記事はこちら。
CentOS5.8にyumでgitをインストールする | hypermkt blog
とりあえず普通にyumでインストールしてみる。
[vagrant@localhost ~]$ sudo yum -y install git Loaded plugins: fastestmirror Loading mirror speeds from cached hostfile * base: ftp.tsukuba.wide.ad.jp * extras: ftp.tsukuba.wide.ad.jp * updates: ftp.tsukuba.wide.ad.jp Setting up Install Process No package git available. Nothing to do
No package git available.だって。
どうやらCentOSのデフォルトのyumリポジトリではgitがないらしい。
epelリポジトリの入手
[vagrant@localhost ~]$ sudo rpm -ivh http://ftp.jaist.ac.jp/pub/Linux/Fedora/epel/5/x86_64/epel-release-5-4.noarch.rpm Retrieving http://ftp.jaist.ac.jp/pub/Linux/Fedora/epel/5/x86_64/epel-release-5-4.noarch.rpm warning: /var/tmp/rpm-xfer.oDCufz: Header V3 DSA signature: NOKEY, key ID 217521f6 Preparing... ########################################### [100%] 1:epel-release ########################################### [100%]
このままだとepelリポジトリがCentOSの公式リポジトリより優先されてしまうようなので、
公式リポジトリを優先するように設定しておかないといけない。
てことでどのリポジトリを優先的に利用するか設定するためにyum-prioritiesをインストールする。
yum-prioritiesのインストール
[vagrant@localhost ~]$ sudo yum install yum-priorities Loaded plugins: fastestmirror Loading mirror speeds from cached hostfile * base: ftp.tsukuba.wide.ad.jp * epel: ftp.kddilabs.jp * extras: ftp.tsukuba.wide.ad.jp * updates: ftp.tsukuba.wide.ad.jp epel | 3.6 kB 00:00 epel/primary_db | 2.9 MB 00:00 Setting up Install Process Resolving Dependencies --> Running transaction check ---> Package yum-priorities.noarch 0:1.1.16-21.el5.centos set to be updated --> Finished Dependency Resolution Dependencies Resolved ======================================================================================================================================================================= Package Arch Version Repository Size ======================================================================================================================================================================= Installing: yum-priorities noarch 1.1.16-21.el5.centos base 16 k Transaction Summary ======================================================================================================================================================================= Install 1 Package(s) Upgrade 0 Package(s) Total download size: 16 k Is this ok [y/N]: y Downloading Packages: yum-priorities-1.1.16-21.el5.centos.noarch.rpm | 16 kB 00:00 Running rpm_check_debug Running Transaction Test Finished Transaction Test Transaction Test Succeeded Running Transaction Installing : yum-priorities 1/1 Installed: yum-priorities.noarch 0:1.1.16-21.el5.centos Complete!
yum-prioritiesがインストールできたら、
baseのprioirtyを1で、他を2とかにすればいける。(たぶん)
Baseリポジトリの優先度を上げる
[vagrant@localhost ~]$ sudo vi /etc/yum.repos.d/CentOS-Base.repo [base] ... +priority=1 #released updates [updates] ... +priority=2 #additional packages that may be useful [extras] ... +priority=2 #additional packages that extend functionality of existing packages [centosplus] ... +priority=2 #contrib - packages by Centos Users [contrib] ... +priority=2
Gitをインストールする
[vagrant@localhost ~]$ sudo yum install git Loaded plugins: fastestmirror, priorities Loading mirror speeds from cached hostfile * base: ftp.tsukuba.wide.ad.jp * epel: ftp.kddilabs.jp * extras: ftp.tsukuba.wide.ad.jp * updates: ftp.tsukuba.wide.ad.jp base | 1.1 kB 00:00 extras | 2.1 kB 00:00 updates | 1.9 kB 00:00 Setting up Install Process Resolving Dependencies --> Running transaction check ---> Package git.x86_64 0:1.8.2.3-1.el5 set to be updated --> Processing Dependency: perl-Git = 1.8.2.3-1.el5 for package: git --> Processing Dependency: rsync for package: git --> Processing Dependency: perl(Term::ReadKey) for package: git --> Processing Dependency: perl(Git) for package: git --> Processing Dependency: perl(Error) for package: git --> Running transaction check ---> Package perl-Error.noarch 1:0.17010-1.el5 set to be updated ---> Package perl-Git.x86_64 0:1.8.2.3-1.el5 set to be updated ---> Package perl-TermReadKey.x86_64 0:2.30-4.el5 set to be updated ---> Package rsync.x86_64 0:3.0.6-6.el5_11 set to be updated --> Finished Dependency Resolution Dependencies Resolved ======================================================================================================================================================================= Package Arch Version Repository Size ======================================================================================================================================================================= Installing: git x86_64 1.8.2.3-1.el5 epel 17 M Installing for dependencies: perl-Error noarch 1:0.17010-1.el5 epel 26 k perl-Git x86_64 1.8.2.3-1.el5 epel 45 k perl-TermReadKey x86_64 2.30-4.el5 epel 32 k rsync x86_64 3.0.6-6.el5_11 updates 347 k Transaction Summary ======================================================================================================================================================================= Install 5 Package(s) Upgrade 0 Package(s) Total download size: 17 M Is this ok [y/N]: y Downloading Packages: (1/5): perl-Error-0.17010-1.el5.noarch.rpm | 26 kB 00:00 (2/5): perl-TermReadKey-2.30-4.el5.x86_64.rpm | 32 kB 00:00 (3/5): perl-Git-1.8.2.3-1.el5.x86_64.rpm | 45 kB 00:00 (4/5): rsync-3.0.6-6.el5_11.x86_64.rpm | 347 kB 00:00 (5/5): git-1.8.2.3-1.el5.x86_64.rpm | 17 MB 00:03 ---------------------------------------------------------------------------------------------------------------------------------------------------------------------- Total 3.1 MB/s | 17 MB 00:05 warning: rpmts_HdrFromFdno: Header V3 DSA signature: NOKEY, key ID 217521f6 epel/gpgkey | 1.7 kB 00:00 Importing GPG key 0x217521F6 "Fedora EPEL" from /etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL Is this ok [y/N]: y Running rpm_check_debug Running Transaction Test Finished Transaction Test Transaction Test Succeeded Running Transaction Installing : perl-Error 1/5 Installing : perl-TermReadKey 2/5 Installing : rsync 3/5 Installing : git 4/5 Installing : perl-Git 5/5 Installed: git.x86_64 0:1.8.2.3-1.el5 Dependency Installed: perl-Error.noarch 1:0.17010-1.el5 perl-Git.x86_64 0:1.8.2.3-1.el5 perl-TermReadKey.x86_64 0:2.30-4.el5 rsync.x86_64 0:3.0.6-6.el5_11 Complete!
[vagrant@localhost ~]$ git --version git version 1.8.2.3
無事インストールできました。