CentOS 7.2: Yum 저장소 구성 실패

CentOS 7.2: Yum 저장소 구성 실패

CentOS 7.2.1511을 새로 설치합니다. 서버는 원래 Network Manager로 구성되었으며 yum이 제대로 작동했습니다. 최근 Network Manager를 비활성화하고 기존 서비스(/etc/sysconfig/network-scripts)로 네트워크를 구성했습니다. 새 IP 주소가 NIC에 할당되었습니다. 설치 프로그램은 원래 10.xxx 네트워크에 있었지만 현재는 192.168.xx 네트워크에 있습니다.

yum을 실행하려고 하면 다음 오류가 발생합니다.

Loaded plugins: fastestmirror, langpacks
http://mirror.centos.org/centos/%24releasever/os/x86_64/repodata/repomd.xml: [Errno 14] HTTP Error 404 - Not Found
Trying other mirror.
To address this issue please refer to the below knowledge base article 

https://access.redhat.com/articles/1320623

If above article doesn't help to resolve this issue please create a bug on https://bugs.centos.org/

http://mirror.centos.org/centos/%24releasever/extras/x86_64/repodata/repomd.xml: [Errno 14] HTTP Error 404 - Not Found
Trying other mirror.


 One of the configured repositories failed (CentOS-$releasever - Extras),
 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 extras

 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=extras.skip_if_unavailable=true

failure: repodata/repomd.xml from extras: [Errno 256] No more mirrors to try.
http://mirror.centos.org/centos/$releasever/extras/x86_64/repodata/repomd.xml: [Errno 14] HTTP Error 404 - Not Found

다음은 네트워크 인터페이스 설정입니다. em1과 em2의 기본 구성은 동일합니다.

TYPE=Ethernet
BOOTPROTO=none
DEFROUTE=yes
PEERDNS=yes
PEERROUTES=yes
NAME=em1
NM_CONTROLLED=no
IPV4_FAILURE_FATAL=no
UUID=d67971e8-846d-428c-9a1d-ff2768ae6ddb
DEVICE=em1
HWADDR=14:18:77:69:D5:DB
ONBOOT=yes
IPADDR=192.168.x.x
NETMASK=255.255.255.0
GATEWAY=192.168.x.x

내 /etc/hosts 파일:

127.0.0.1   localhost localhost.localdomain localhost4 localhost4.localdomain4
::1         localhost localhost.localdomain localhost6 localhost6.localdomain6
192.168.x.x hostname

내 /etc/resolv.conf 파일:

nameserver 68.105.28.12
nameserver 68.105.29.11

내 CentOS-Base.repo 파일. 이것이 작동하는지 확인하기 위해 baseurl 설정의 주석 처리를 제거했습니다.

# 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
skip_if_unavailable = 1
keepcache = 0

#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

Yum repolist의 결과:

Loaded plugins: fastestmirror, langpacks
http://mirror.centos.org/centos/%24releasever/os/x86_64/repodata/repomd.xml:   [Errno 14] HTTP Error 404 - Not Found
Trying other mirror.
To address this issue please refer to the below knowledge base article 

https://access.redhat.com/articles/1320623

If above article doesn't help to resolve this issue please create a bug on   https://bugs.centos.org/

  http://mirror.centos.org/centos/%24releasever/extras/x86_64/repodata/repomd.xml: [Errno 14] HTTP Error 404 - Not Found
Trying other mirror.
http://mirror.centos.org/centos/%24releasever/extras/x86_64/repodata/repomd.xml: [Errno 14] HTTP Error 404 - Not Found
Trying other mirror.
http://mirror.centos.org/centos/%24releasever/updates/x86_64/repodata/repomd.xml: [Errno 14] HTTP Error 404 - Not Found
Trying other mirror.
repo id                                                                           repo name                                                                         status
extras/$releasever/x86_64                                                       CentOS-$releasever - Extras                                                   0
updates/$releasever/x86_64                                                  CentOS-$releasever - Updates                                                  0
repolist: 0

컬 결과:

curl 'http://mirrorlist.centos.org/?release=6&arch=i386&repo=os'
http://mirrors.usc.edu/pub/linux/distributions/centos/6.8/os/i386/
http://mirror.lug.udel.edu/pub/centos/6.8/os/i386/
http://mirrors.lga7.us.voxel.net/centos/6.8/os/i386/
http://mirror.chpc.utah.edu/pub/centos/6.8/os/i386/
http://centos.unixheads.org/6.8/os/i386/
http://centos.mirror.lstn.net/6.8/os/i386/
http://centos.mirror.nac.net/6.8/os/i386/
http://mirror.tocici.com/centos/6.8/os/i386/
http://mirror.supremebytes.com/centos/6.8/os/i386/
http://mirror.steadfast.net/centos/6.8/os/i386/

외부 호스트로 ping을 수행하고 도메인 이름을 검색할 수 있습니다.

dig cnn.com

; <<>> DiG 9.9.4-RedHat-9.9.4-29.el7_2.3 <<>> cnn.com
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 29420
;; flags: qr rd ra; QUERY: 1, ANSWER: 2, AUTHORITY: 0, ADDITIONAL: 1

;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 4096
;; QUESTION SECTION:
;cnn.com.           IN  A

;; ANSWER SECTION:
cnn.com.        156 IN  A   157.166.226.26
cnn.com.        156 IN  A   157.166.226.25

;; Query time: 1 msec
;; SERVER: 68.105.28.12#53(68.105.28.12)
;; WHEN: Mon Jun 20 12:28:44 EDT 2016
;; MSG SIZE  rcvd: 68

나는 이것이 서로 다른 IP 주소에 바인딩된 em1 및 em2의 이전 구성과 관련이 있다고 확신하지만 다른 곳을 찾아야 할지 모르겠습니다. 냠냠이 작동하도록 하려면 내가 무엇을 놓치고 있을까요?

답변1

좀 더 조사한 끝에 나는 그것을 알아냈습니다. 디렉토리 계층 구조가 누락되어 yum이 내 CentOS 버전을 감지할 수 없습니다. 다음 명령을 실행하면 문제가 바로 해결되었습니다.

mkdir -p /etc/yum/vars
echo 7.2.1511 > /etc/yum/vars/releasever

이 문제가 발생하고 다른 방법이 작동하지 않는 경우 "7.2.1511"을 자체 릴리스 버전으로 바꾸십시오.

업데이트 2017년 5월 21일: "7.2.1511" 경로가 더 이상 사용되지 않습니다. 아직 CentOS 7.2.1511을 사용 중인 경우 다음 명령을 실행하여 yum을 계속 작동시키세요.

echo 7 > /etc/yum/vars/releasever

yum이 작동을 멈춘 것을 갑자기 발견하면 문제가 해결됩니다.

답변2

원천

해결 방법은 다음 명령을 실행하는 것입니다.

rm -fr /var/cache/yum/x86_64/7
yum clean all

이것은 나에게 효과적이었습니다. CentOS Linux 릴리스 7.2.1511(코어)

답변3

http://mirror.centos.org/centos/%24releasever/os/x86_64/repodata/repomd.xml: [Errno 14] HTTP 오류 404 - 찾을 수 없음 다른 미러를 시도하는 중입니다.

이것은 당신이 알아야 할 것을 정확하게 알려줍니다.

[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
skip_if_unavailable = 1
keepcache = 0

#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

물음표와 매개변수 사이의 공백에 유의하세요.

http://mirrorlist.centos.org/? release=$releasever&arch=$basearch&repo=os&infra=$infra

그리고 탭

미러리스트=http://mirrorlist.centos.org/? release=$releasever&arch=$basearch&repo=업데이트&infra=$infra

당신이해야 할 일은 ?와 사이의 공백을 제거하는 것입니다release

관련 정보