centos 7.1 - error repository

2020-05-19 02:25发布

Hello I have download the minimal release of CENTOS 7 at this url link download ISO centos 7.x

All work correctly...the PING and the network is OK. I ping to external HOST for example.

But when I digit :

[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

Why?

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 ~]#

The content of the file /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 ~]#

标签: centos yum
9条回答
闹够了就滚
2楼-- · 2020-05-19 02:40

I had this problem in a company environment with MITM proxy after adding the EPEL repo with

yum install epel-release

This doesn't happen before (e.g. on yum update). I checked all answers and none of them fixed my problem. Figured out that the other repos use http by default, where epel use 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

So I copied our company root CA in the CentOS trust store and update it:

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

After adding the cert, updating and installing packages from the EPEL repo works fine!

查看更多
祖国的老花朵
3楼-- · 2020-05-19 02:41

Uncomment baseurl in this file: /etc/yum.repos.d/CentOS-Base.repo

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

In this block:

[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

By uncomment, I mean change this: #baseurl=http://mirror.centos.org/centos/$releasever/os/$basearch/, to this: baseurl=http://mirror.centos.org/centos/$releasever/os/$basearch/ (remove the #).

查看更多
爷的心禁止访问
4楼-- · 2020-05-19 02:47

First of all, I was able to fix this issue as mentioned above by using "dhclient". But you will have to run this command every time you reboot. This could be because your Ethernet is disabled and you have to enable it explicitly. Click here to see the reason. For a permanent fix I edited /etc/sysconfig/network-scripts/ifcfg-{YOURETHERNET} (In my case it was /etc/sysconfig/network-scripts/ifcfg-eth0) and changed ONBOOT=yes and boom!!!

查看更多
贪生不怕死
5楼-- · 2020-05-19 02:48

The problem is config of dhcp, try typing

dhclient
查看更多
ら.Afraid
6楼-- · 2020-05-19 02:55

This issue can also happen if the yum repository in question is actually offline or not responding correctly.

This can be a little tricky to diagnose, but the yum repo might respond to ping and respond to web requests on the base URL, but does not serve up packages correctly.

To find the problematic repo, I've found what works best is to move each repo file out of /etc/yum.repos.d and into a temporary holding folder (e.g., /root/yum_bak) and run yum update after removing each repo. Once you've moved the problematic repo out of /etc/yum.repos.d then yum update (and other yum commands will start working normally again. Move the working yum repos back into /etc/yum.repos.d and you're back in business.

Just don't forget to move the problematic repo back into /etc/yum.repos.d after the outage has ended.

查看更多
女痞
7楼-- · 2020-05-19 03:02

It is the error coming from the https connection in /etc/yum.repos.d/epel.repo after you installed ius-release.rpm through

sudo yum install -y https://centos7.iuscommunity.org/ius-release.rpm

You need to do following stuff in /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

Uncomment baseurl and comment line beginning with mirrorlist=.

查看更多
登录 后发表回答