
Hyper-V에 CentOS 7을 성공적으로 설치했지만 yum update를 사용하여 업데이트하거나 명령을 사용하여 설치하려고 하면 yum
아래 오류가 발생합니다.
Loaded plugins: fastestmirror, langpacks Could not retrieve mirrorlist
http://mirrorlist.centos.org/?release=7&arch=x86_64&repo=os&infra=stock
error was 12: Timeout on
http://mirrorlist.centos.org/?release=7&arch=x86_64&repo=os&infra=stock:
(28, 'Resolving timed out after 30425 milliseconds')
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`
답변1
(28, 'Resolving timed out after 30425 milliseconds')
이는 VM에 작동 중인 DNS 서버가 부족할 수 있음을 의미합니다. 여기서 확인이란 도메인 이름을 IP 주소로 확인하는 것을 의미합니다.
google.com 또는 mirrorlist.centos.org에 핑을 보내 DNS 기능이 있는지 확인해 보세요. 현재 사용되는 DNS 서버는 다음 목록에 나열되어 있습니다./etc/resolv.conf이렇게:
nameserver 8.8.8.8
nameserver 8.8.4.4
만약/etc/resolv.conf파일이 비어 있으면 먼저 위의 IP 주소(Google의 공개 DNS)에 ping을 시도한 다음 해당 주소를/etc/resolv.confGoogle DNS 사용을 시작하려면 위와 같은 파일을 사용하세요. 이 문제를 영구적으로 해결하려면 CentOS 7 네트워크 구성 도구를 사용하여 DNS 서버를 올바르게 설정하는 것이 좋습니다. 이를 수행하는 방법에 대한 괜찮은 기사는 다음과 같습니다.http://www.krizna.com/centos/setup-network-centos-7/
답변2
어떤 IP 기본 경로가 가는지 확인하는 데 사용합니다 ip route
. 아무 것도 표시되지 않으면 다음을 통해 수행할 수 있는 새로운 IP를 가져와야 합니다.
sudo dhclient
이렇게 하면 문제가 해결되어야 합니다. 지금 시도해 보세요 yum update
.
답변3
ipv6 문제입니다. runnig에서 ipv6을 비활성화합니다.
lsmod | grep -i ipv6
sysctl --all
nslookup google.com
systemctl stop NetworkManager
systemctl disable NetworkManager
cd /etc/default
change line to : GRUB_CMDLINE_LINUX="ipv6.disable=1 rd.lvm.lv=centos/swap vconsole.font=latarcyrh
grub2-mkconfig -o /boot/grub2/grub.cfg
vi grub
ip addr
참고: grub에 비활성화 명령을 추가하세요.
답변4
"/etc/sysconfig/network-scripts/ifcfg-enp0s17" 파일을 찾으세요. **파일 이름은 환경에 따라 다를 수 있습니다. 1.라인 찾기: BOOTPROTO=none ONBOOT=no
BOOTPROTO=dhcp ONBOOT=yes로 변경하고 저장 + 종료
"systemctl restart network"를 실행하세요.