Gcc 存储库链接在CentOS 6中无法运行yum.conf

Gcc 存储库链接在CentOS 6中无法运行yum.conf,gcc,centos,yum,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-releas

我使用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]# 
[root@SERVERetc]#yum更新
正在从服务器收集头信息文件
服务器:Red Hat Linux 6-x86_64-Base
retrygrab()失败,原因是:
http://mirror.dulug.duke.edu/pub/yum-repository/redhat/6/x86_64/headers/header.info
执行故障转移方法
故障转移:没有服务器可供尝试
获取文件时出错http://mirror.dulug.duke.edu/pub/yum-repository/redhat/6/x86_64/headers/header.info
[Errno 4]IOError:
[root@SERVER等等]#
我相信这是由于一些旧的yum镜像被关闭,但是我无法在我的yum.conf文件中找到任何对正确存储库集的引用,该文件将在CentOS 6.4上运行

问题是:有人知道我在哪里可以找到一组在这种情况下可以工作的存储库吗?我知道现在可以在找到Yum网站,但是我看不到任何关于应该在Yum.conf文件中放置哪些存储库的明确信息


我显然是一个linux新手,所以如果我错过了一些重要的东西,请轻轻地炒我…

看起来你混合了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)中的repo。她的/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