存储库链接在CentOS 6中不起作用yum.conf

时间:2014-02-18 11:06:36

标签: gcc centos yum

我使用RedHat和Centos 6.4运行Linux服务器

我需要在服务器上安装gcc,所以我一直在尝试使用yum为我安装gcc,但由于yum.conf文件,我似乎在使用yum安装和更新软件包时遇到了一些问题

如果我打开当前的yum.conf文件,我会看到以下代码:

[main]
cachedir=/var/cache/yum
debuglevel=2
logfile=/var/log/yum.log
pkgpolicy=newest
distroverpkg=redhat-release
tolerant=1
exactarch=1

[base]
name=Red Hat Linux $releasever - $basearch - Base
baseurl=http://mirror.dulug.duke.edu/pub/yum-repository/redhat/$releasever/$basearch/


[updates]
name=Red Hat Linux $releasever - Updates
baseurl=http://mirror.dulug.duke.edu/pub/yum-repository/redhat/updates/$releasever/

每当我尝试运行yum命令时 - 例如,“yum update”我的终端出现以下错误:

[root@SERVER etc]# yum update
Gathering header information file(s) from server(s)
Server: Red Hat Linux 6 - x86_64 - Base
retrygrab() failed for:
  http://mirror.dulug.duke.edu/pub/yum-repository/redhat/6/x86_64/headers/header.info
  Executing failover method
failover: out of servers to try
Error getting file http://mirror.dulug.duke.edu/pub/yum-repository/redhat/6/x86_64/headers/header.info
[Errno 4] IOError: <urlopen error >
[root@SERVER etc]# 

我认为这是由于一些旧的yum镜像被关闭,但是我找不到任何可以在我的yum.conf文件中使用的适当的存储库集的引用,这可以在CentOS 6.4上运行

问题是:有没有人知道在哪里可以找到一组可以在这种情况下工作的存储库?我知道Yum网站现在可以在http://yum.baseurl.org/找到,但我看不清楚我应该在yum.conf文件中添加哪些存储库。

我显然是一个Linux新手,所以如果我错过了一些重要的东西,请轻轻点燃我......

1 个答案:

答案 0 :(得分:1)

看起来你有CentOS和RedHat位的混合。删除你添加的内容。 CentOS很简单(以下示例)。对于RedHat,如果您不是注册机器,则需要使用DVD ISO作为源(baseurl = file:/// media)或者可以附加到公共EPEL。

这是CentOS /etc/yum.conf。

[main]
cachedir=/var/cache/yum/$basearch/$releasever
keepcache=0
debuglevel=2
logfile=/var/log/yum.log
exactarch=1
obsoletes=1
gpgcheck=1
plugins=1
installonly_limit=5
bugtracker_url=http://bugs.centos.org/set_project.php?project_id=16&ref=http://bugs.centos.org/bug_report_page.php?category=yum distroverpkg=centos-release

然后你应该在/etc/yum.repos.d(base / debuginfo / media / vault)中有一些已经存在的repos。她是/etc/yum.repos.d/CentOS-Base.repo

[base]
name=CentOS-$releasever - Base
mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=os
#baseurl=http://mirror.centos.org/centos/$releasever/os/$basearch/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6

#released updates
[updates]
name=CentOS-$releasever - Updates
mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=updates
#baseurl=http://mirror.centos.org/centos/$releasever/updates/$basearch/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6

#additional packages that may be useful
[extras]
name=CentOS-$releasever - Extras
mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=extras
#baseurl=http://mirror.centos.org/centos/$releasever/extras/$basearch/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6

#additional packages that extend functionality of existing packages
[centosplus]
name=CentOS-$releasever - Plus
mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=centosplus
#baseurl=http://mirror.centos.org/centos/$releasever/centosplus/$basearch/
gpgcheck=1
enabled=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6

#contrib - packages by Centos Users
[contrib]
name=CentOS-$releasever - Contrib
mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=contrib
#baseurl=http://mirror.centos.org/centos/$releasever/contrib/$basearch/
gpgcheck=1
enabled=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6