yum install git 出现错误:
[root@myhost test]# yum install git Loaded plugins: fastestmirror Loading mirror speeds from cached hostfile * addons: mirror.neu.edu.cn * base: mirror.neu.edu.cn * extras: mirror.neu.edu.cn * updates: mirror.neu.edu.cn addons | 951 B 00:00 base | 2.1 kB 00:00 extras | 2.1 kB 00:00 updates | 1.9 kB 00:00 Setting up Install Process No package git available. Nothing to do |
解决办法:
需要先添加EPEL(Extra Packages for Enterprise Linux) repository:
#CentOS5.x 32-bit(x86/i386): rpm -Uvh http://dl.fedoraproject.org/pub/epel/5/i386/epel-release-5-4.noarch.rpm #CentOS5.x 64-bit(x64): rpm -Uvh http://dl.fedoraproject.org/pub/epel/5/x86_64/epel-release-5-4.noarch.rpm #CentOS6.x32-bit (x86/i386): rpm -Uvh http://download.fedoraproject.org/pub/epel/6/i386/epel-release-6-5.noarch.rpm #CentOS6.x 64-bit(x64): rpm -Uvh http://download.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-5.noarch.rpm |
然后yum install git
就能安装了。
备注: 查看centos版本的方法:
root@MyMail ~ # cat /etc/redhat-release
CentOS release 5.4 (Final)有以下命令可以查看:
# lsb_release -a
LSB Version::core-3.1-ia32:core-3.1-noarch:graphics-3.1-ia32:graphics-3.1-noarch
Distributor ID: CentOS
Description: CentOS release 5.4 (Final)
Release: 5.4
Codename: Final这个命令适用于所有的linux,包括Redhat、SuSE、Debian等发行版。
root@MyMail ~ # uname
Linux
root@MyMail ~ # uname -r
2.6.18-164.el5以下二种方法适用于RedHat,CentOS
root@MyMail ~ # cat /etc/redhat-release
CentOS release 5.4 (Final)登录到linux执行rpm -qredhat-release
#rpm -q redhat-release
或CentOSroot@MyMail ~ # rpm -q centos-release
centos-release-5-4.el5.centos.1