명령어 입력
[root@localhost ~]# yum update
에러메시지
Loaded plugins: fastestmirror Loading mirror speeds from cached hostfile Could not retrieve mirrorlist http://mirrorlist.centos.org/?release=7&arch=x86_64&repo=os&infra=stock error was 14: curl#6 - "Could not resolve host: mirrorlist.centos.org; 알 수 없는 오류" 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. Run the command with the repository temporarily disabled yum --disablerepo=<repoid> ... 4. Disable the repository permanently, 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> or subscription-manager repos --disable=<repoid> 5. 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 |
조치방법 1 : nameserver 추가
/etc/resolv.conf 파일에 아래 내용 추가
nameserver 8.8.8.8
nameserver 8.8.4.4
!! nameserver 추가해도 원래대로 돌아오는 경우
원인
/etc/resolv.conf 파일이 설정 후 자동으로 복원되는 것은 NetworkManager가 해당 파일을 관리하고 있기 때문입니다. NetworkManager는 네트워크 설정을 자동으로 처리하며, /etc/resolv.conf 파일을 네트워크 인터페이스에 따라 자동으로 업데이트합니다.
NetworkManager를 통한 DNS 설정 변경 방법
- NetworkManager 설정 파일 수정 NetworkManager의 DNS 설정을 변경하여 resolv.conf 파일을 직접 수정해도 다시 복원되지 않게 할 수 있습니다./etc/NetworkManager/NetworkManager.conf 파일을 열어 아래와 같이 dns 항목을 수정합니다.
sudo vi /etc/NetworkManager/NetworkManager.conf
아래 항목 추가
[main]
dns=none
*dns=none 설정을 추가하면, NetworkManager는 /etc/resolv.conf 파일을 자동으로 변경하지 않습니다.
2. 네트워크 설정을 재시작 설정을 저장한 후, NetworkManager를 재시작하여 적용합니다.
sudo systemctl restart NetworkManager
3. 수동으로 DNS 서버 설정 이제 /etc/resolv.conf 파일을 수동으로 편집하여 DNS 서버를 설정할 수 있습니다. /etc/resolv.conf에 원하는 DNS 서버를 추가합니다.
sudo vi /etc/resolv.conf
아래 항목 추가
nameserver 8.8.8.8
nameserver 8.8.4.4
2. yum 리포지토리 설정 변경
> 에러메시지 :
failure: repodata/repomd.xml from updates: [Errno 256] No more mirrors to try. http://mirror.centos.org/centos/7/updates/x86_64/repodata/repomd.xml: [Errno 14] HTTP Error 404 - Not Found |
2024년 6월 30일 CentOS 7 EOS에 따라 기존 레포지토리 내 패키지들이 삭제된 것으로 확인되어 기존에 사용중이던 yum repository 주소를 변경
ls /etc/yum.repos.d/
sudo rm /etc/yum.repos.d/CentOS-Base.repo
sudo vi /etc/yum.repos.d/CentOS-Base.repo
yum cache all
yum update