这就是我得到的
$ sudo yum install git-core
file://localhost/tmp/common1/x86_64/redhat/50/base/ga/Server/repodata/repomd.xml: [Errno 5] OSError: [Errno 2] No such file or directory: '/tmp/common1/x86_64/redhat/50/base/ga/Server/repodata/repomd.xml'
Trying other mirror.
Setting up Install Process
No package git-core available.
Nothing to do
$
Run Code Online (Sandbox Code Playgroud)
这里有什么问题?
更新:配置文件的当前状态:
$ cat /etc/yum.conf
[main]
cachedir=/var/cache/yum
debuglevel=2
logfile=/var/log/yum.log
pkgpolicy=newest
distroverpkg=redhat-release
tolerant=1
exactarch=1
metadata_expire=0
[base]
name=Red Hat Linux - Base
baseurl=file://localhost/tmp/common1/x86_64/redhat/50/base/ga/Server
$ ls /etc/yum.repos.d/
$
Run Code Online (Sandbox Code Playgroud)
好的,这里有几件事:
您的存储库位置显然是file://localhost/tmp/(我不确定是否使用 file://localhost/,但我假设它是转到 file:/// 的快捷方式,但主要问题是在该路径中使用 /tmp。位于 /tmp 下的文件将在重启时被清除(大多数情况下)。这将解释以后的故障。
因此,第 1 步是恢复您的本地存储库(使用与您第一次创建它时使用的方法相同的方法,如果您打算将来再次使用它,我建议使用 /tmp 以外的位置 - 请记住您编辑您的存储库yum.conf 或 yum.repos.d/ 中的条目并使用新路径)或将其连接到 RHN(我假设您使用的这个 repo 源是 RHEL 5 GOLD 树的目录结构)。
设置好存储库后,您将需要从 source或EPEL (Extra Packages for Enterprise Linux)安装git。
不过要注意的是:
我认为存储库设置有问题。检查/etc/yum.repos.d/或中的条目/etc/yum.conf或/etc/yum/...
编辑:
很明显,baseurlin baserepo 是无效的。我无法找到适用于 RHEL 5.6 的正确存储库,但根据 Wikipedia, RHEL 5 仍然受支持,因此存储库应该适用于 5.6 或至少适用于 5.8,因为这是 5.x 行的最新版本。
我看到两个选择:
根据Gilles在《Is CentOS 与 RHEL 完全一样吗?》中的回答 您还可以尝试添加 CentOS 存储库。
我不是 CentOS 用户,但我发现了以下 CentOS 的存储库配置:
[base] name=CentOS-5 - Base
baseurl=http://mirror.centos.org/centos/$releasever/os/$basearch/
gpgcheck=0
Run Code Online (Sandbox Code Playgroud)
如果返回错误尝试替换$releasever为5.