1.尝试用yum安装git失败

[root@localhost usr]# yum install git

Loaded plugins: fastestmirror

Loading mirror speeds from cached hostfile

* addons: mirrors.aliyun.com

* base: mirrors.aliyun.com

* extras: mirrors.aliyun.com

* updates: mirrors.aliyun.com

Setting up Install Process

No package git available.

Nothing to do

2.解决方法

[root@localhost usr]# uname -a

Linux localhost.localdomain 2.6.18-194.el5 #1 SMP Fri Apr 2 14:58:14 EDT 2010 x86_64 x86_64 x86_64 GNU/Linux

 

使用这个命令处理

[root@localhost usr]# rpm -Uvh http://dl.fedoraproject.org/pub/epel/5/x86_64/epel-release-5-4.noarch.rpm

Retrieving http://dl.fedoraproject.org/pub/epel/5/x86_64/epel-release-5-4.noarch.rpm

warning: /var/tmp/rpm-xfer.bmY1Kp: Header V3 DSA signature: NOKEY, key ID 217521f6

Preparing... ########################################### [100%]

1:epel-release ########################################### [100%]

 

3.再次安装

[root@localhost ~]# yum install git

Loaded plugins: fastestmirror

Loading mirror speeds from cached hostfile

* addons: mirrors.aliyun.com

* base: mirrors.aliyun.com

* epel: mirrors.opencas.cn

* extras: mirrors.aliyun.com

* updates: mirrors.aliyun.com

epel | 3.6 kB 00:00

epel/primary_db | 2.9 MB 00:09

Setting up Install Process

Resolving Dependencies

--> Running transaction check

---> Package git.x86_64 0:1.8.2.1-1.el5 set to be updated

--> Processing Dependency: perl-Git = 1.8.2.1-1.el5 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.1-1.el5 set to be updated

---> Package perl-TermReadKey.x86_64 0:2.30-4.el5 set to be updated

--> Finished Dependency Resolution

Dependencies Resolved

================================================================================

Package Arch Version Repository Size

================================================================================

Installing:

git x86_64 1.8.2.1-1.el5 epel 7.4 M

Installing for dependencies:

perl-Error noarch 1:0.17010-1.el5 epel 26 k

perl-Git x86_64 1.8.2.1-1.el5 epel 49 k

perl-TermReadKey x86_64 2.30-4.el5 epel 32 k

Transaction Summary

================================================================================

Install 4 Package(s)

Upgrade 0 Package(s)

Total download size: 7.5 M

Is this ok [y/N]:                        //此处需要自己输入y,然后enter键

Downloading Packages:

(1/4): perl-Error-0.17010-1.el5.noarch.rpm | 26 kB 00:00

(2/4): perl-TermReadKey-2.30-4.el5.x86_64.rpm | 32 kB 00:00

(3/4): perl-Git-1.8.2.1-1.el5.x86_64.rpm | 49 kB 00:00

(4/4): git-1.8.2.1-1.el5.x86_64.rpm | 7.4 MB 00:24

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

Total 303 kB/s | 7.5 MB 00:25

warning: rpmts_HdrFromFdno: Header V3 DSA signature: NOKEY, key ID 217521f6

epel/gpgkey | 1.7 kB 00:00

Importing GPG key 0x217521F6 "Fedora EPEL <epel@fedoraproject.org>" from /etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL

Is this ok [y/N]:                            //此处需要自己输入y,然后enter键

Running rpm_check_debug

Running Transaction Test

Finished Transaction Test

Transaction Test Succeeded

Running Transaction

Installing : perl-TermReadKey 1/4

Installing : perl-Error 2/4

Installing : git 3/4

Installing : perl-Git 4/4

Installed:

git.x86_64 0:1.8.2.1-1.el5

Dependency Installed:

perl-Error.noarch 1:0.17010-1.el5 perl-Git.x86_64 0:1.8.2.1-1.el5 perl-TermReadKey.x86_64 0:2.30-4.el5

Complete!

 

[root@localhost ~]# git --version

git version 1.8.2.1