centos 7.1 - 错误存储库

时间:2015-09-11 13:27:43

标签: centos yum

您好我已经在此网址下载了CENTOS 7的最小版本 link download ISO centos 7.x

一切正常...... PING和网络都没问题。例如,我ping外部HOST。

但是当我数字时:

[root@localhost ~]# yum update
Loaded plugins: fastestmirror


 One of the configured repositories failed (Unknown),
 and yum doesn't have enough cached data to continue. At this point the only
 safe thing yum can do is fail. There are a few ways to work "fix" this:

     1. Contact the upstream for the repository and get them to fix the problem.

     2. Reconfigure the baseurl/etc. for the repository, to point to a working
        upstream. This is most often useful if you are using a newer
        distribution release than is supported by the repository (and the
        packages for the previous distribution release still work).

     3. Disable the repository, so yum won't use it by default. Yum will then
        just ignore the repository until you permanently enable it again or use
        --enablerepo for temporary usage:

            yum-config-manager --disable <repoid>

     4. Configure the failing repository to be skipped, if it is unavailable.
        Note that yum will try to contact the repo. when it runs most commands,
        so will have to try and fail each time (and thus. yum will be be much
        slower). If it is a very temporary problem though, this is often a nice
        compromise:

            yum-config-manager --save --setopt=<repoid>.skip_if_unavailable=true

Cannot find a valid baseurl for repo: base/7/x86_64

为什么?

This is another command:


root@localhost ~]# yum repolist all
Loaded plugins: fastestmirror
repo id                           repo name                           status
C7.0.1406-base/x86_64             CentOS-7.0.1406 - Base              disabled
C7.0.1406-centosplus/x86_64       CentOS-7.0.1406 - CentOSPlus        disabled
C7.0.1406-extras/x86_64           CentOS-7.0.1406 - Extras            disabled
C7.0.1406-fasttrack/x86_64        CentOS-7.0.1406 - CentOSPlus        disabled
C7.0.1406-updates/x86_64          CentOS-7.0.1406 - Updates           disabled
base/7/x86_64                     CentOS-7 - Base                     enabled: 0
base-debuginfo/x86_64             CentOS-7 - Debuginfo                disabled
base-source/7                     CentOS-7 - Base Sources             disabled
centosplus/7/x86_64               CentOS-7 - Plus                     disabled
centosplus-source/7               CentOS-7 - Plus Sources             disabled
cr/7/x86_64                       CentOS-7 - cr                       disabled
extras/7/x86_64                   CentOS-7 - Extras                   enabled: 0
extras-source/7                   CentOS-7 - Extras Sources           disabled
fasttrack/7/x86_64                CentOS-7 - fasttrack                disabled
updates/7/x86_64                  CentOS-7 - Updates                  enabled: 0
updates-source/7                  CentOS-7 - Updates Sources          disabled
repolist: 0
[root@localhost ~]#

文件内容 /etc/yum.repos.d/CentOS-Base.repo

[root@localhost ~]# cat /etc/yum.repos.d/CentOS-Base.repo
# CentOS-Base.repo
#
# The mirror system uses the connecting IP address of the client and the
# update status of each mirror to pick mirrors that are updated to and
# geographically close to the client.  You should use this for CentOS updates
# unless you are manually picking other mirrors.
#
# If the mirrorlist= does not work for you, as a fall back you can try the
# remarked out baseurl= line instead.
#
#

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

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

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

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

[root@localhost ~]#

9 个答案:

答案 0 :(得分:56)

问题是配置dhcp,尝试输入

var imgarray=[],lightchange = 1;

imgarray[0].src = "A452 Images/red traffic light.png";
imgarray[1].src = "A452 Images/yellow traffic light.png";
imgarray[2].src = "A452 Images/green traffic light.png";

function fnnextimage(){

    lightchange++;

    if(lightchange==3)
        lightchange=1;

    document.getElementById('red').src=imgarray[lightchange-1];
}

答案 1 :(得分:5)

在此文件中取消注释baseurl/etc/yum.repos.d/CentOS-Base.repo

#baseurl=http://mirror.centos.org/centos/$releasever/os/$basearch/

在这个块中:

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

取消注释,我的意思是更改此内容:#baseurl=http://mirror.centos.org/centos/$releasever/os/$basearch/,改为:baseurl=http://mirror.centos.org/centos/$releasever/os/$basearch/(删除#)。

答案 2 :(得分:5)

检查resolv.conf以查看名称服务器指向的位置。确保它是合法的,因为我指向网络上已被清除的旧DNS服务器。我用新的IP地址更新了它瞧!

答案 3 :(得分:1)

首先,我通过使用&#34; dhclient&#34;解决了上述问题。但是每次重新启动时都必须运行此命令。 这可能是因为您的以太网已禁用,您必须明确启用它。 Click here to see the reason。对于永久修复,我编辑了/ etc / sysconfig / network-scripts / ifcfg- {YOURETHERNET}(在我的情况下是/ etc / sysconfig / network-scripts / ifcfg-eth0)并更改了ONBOOT = yes和boom !!! < / p>

答案 4 :(得分:1)

通过

安装ius-release.rpm后来自/etc/yum.repos.d/epel.repo中的https连接的错误
sudo yum install -y https://centos7.iuscommunity.org/ius-release.rpm

您需要在/etc/yum.repos.d/epel.repo中执行以下操作。

baseurl=http://download.fedoraproject.org/pub/epel/7/$basearch
#mirrorlist=https://mirrors.fedoraproject.org/metalink?repo=epel-7&arch=$basearch

取消注释baseurl并以mirrorlist=开头的评论行。

答案 5 :(得分:1)

sudo sed -i 's/https/http/g' /etc/yum.repos.d/epel.repo

答案 6 :(得分:0)

我登陆这里是因为我为不同的依赖项添加了一个坏镜像(乘客,对于Rails应用程序),并通过删除坏镜子解决了这个问题:

rm /etc/yum.repos.d/YOUR-BAD-DEPENDENCY-NAME.repo

e.g。

rm /etc/yum.repos.d/passenger.repo

答案 7 :(得分:0)

如果有问题的yum存储库实际上处于脱机状态或无法正确响应,也会发生此问题。

诊断这可能有点棘手,但yum repo可能会响应ping并响应基本URL上的Web请求,但不能正确提供包。

要查找有问题的回购,我发现最有效的方法是将每个回购文件移出/etc/yum.repos.d并移入临时保留文件夹(例如/root/yum_bak)并运行{{1}删除每个回购后。一旦您将有问题的仓库移出yum update,然后/etc/yum.repos.d(其他yum命令将再次开始正常工作。将工作yum回购移回yum update,然后您又回来了生意。

请勿忘记在停电结束后将有问题的回购移回/etc/yum.repos.d

答案 8 :(得分:0)

在使用MITM代理的公司环境中,使用

添加EPEL存储库后,我遇到了这个问题
yum install epel-release

以前不会发生这种情况(例如在yum update上)。我检查了所有答案,但都没有解决我的问题。 找出其他存储库默认情况下使用http,其中epel使用https:

# grep mirror /etc/yum.repos.d/epel.repo
metalink=https://mirrors.fedoraproject.org/metalink?repo=epel-7&arch=$basearch&infra=$infra&content=$contentdir
metalink=https://mirrors.fedoraproject.org/metalink?repo=epel-debug-7&arch=$basearch&infra=$infra&content=$contentdir
metalink=https://mirrors.fedoraproject.org/metalink?repo=epel-source-7&arch=$basearch&infra=$infra&content=$contentdir

因此,我在CentOS信任库中复制了公司的根CA,并对其进行了更新:

cp /home/user/my-ca.crt /etc/pki/ca-trust/source/anchors/
update-ca-trust

添加证书后,从EPEL存储库更新和安装软件包即可正常工作!