티스토리 뷰

반응형

■ 문제 발생

CentOS 7에서 `yum`을 이용해 git client를 설치하려고 했는데 다음과 같은 오류가 발생했다.

[hyper@localhost ~]$ sudo yum install git
[sudo] hyper의 암호:
Loaded plugins: fastestmirror
Determining fastest mirrors
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

 

■ 원인 파악

`mirrorlist.centos.org` 호스트와 연결이 되지 않아 발생하는 문제인 것 같은데...

 

이미 네트워크 설정은 마쳐서 `ping`은 잘 오는 상태였고 네트워크도 설정한 `ens33`으로 연결된 상태였다.

[hyper@localhost ~]$ ping 8.8.8.8
PING 8.8.8.8 (8.8.8.8) 56(84) bytes of data.
64 bytes from 8.8.8.8: icmp_seq=1 ttl=113 time=32.1 ms
64 bytes from 8.8.8.8: icmp_seq=2 ttl=113 time=32.1 ms
^C
--- 8.8.8.8 ping statistics ---
2 packets transmitted, 2 received, 0% packet loss, time 1010ms
rtt min/avg/max/mdev = 32.102/32.103/32.104/0.001 ms

[hyper@localhost ~]$ nmcli d
DEVICE  TYPE      STATE          CONNECTION
ens33   ethernet  연결됨         ens33
lo      loopback  관리되지 않음  --

구글링을 해보니 위와 같은 오류는 DNS 설정을 하지 않았을 경우에 발생하는 문제였다.

 

`/etc/resolv.conf` 파일에 DNS 설정을 해줘야하는데, 현재는 이렇게 빈 내용이 출력되고 있었다.

[hyper@localhost ~]$ cat /etc/resolv.conf

 

■ 문제 해결

`/etc/resolv.conf` 파일에 nameserver를 추가해준다.

 

nameserver는 network 설정 시에 입력한 DNS 주소와 동일한 IP를 입력하면 된다. (`/etc/sysconfig/network-scripts/ifcfg-ens33` 파일 참고)

[hyper@localhost ~]$ sudo vi /etc/resolv.conf
[sudo] hyper의 암호:

[hyper@localhost ~]$ cat /etc/resolv.conf
nameserver x.x.x.x

nameserver를 설정한 뒤에 `yum` 명령을 다시 수행하면 정상적으로 동작하는 것을 확인할 수 있다!

[hyper@localhost ~]$ sudo yum install git
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
 * base: mirror.kakao.com
 * extras: mirror.kakao.com
 * updates: mirror.kakao.com
Resolving Dependencies
--> Running transaction check
---> Package git.x86_64 0:1.8.3.1-23.el7_8 will be installed
--> Processing Dependency: perl-Git = 1.8.3.1-23.el7_8 for package: git-1.8.3.1-23.el7_8.x86_64

...(중략)

Complete!

 

 

 

반응형
댓글
반응형
공지사항
최근에 올라온 글
최근에 달린 댓글
Total
Today
Yesterday
링크
«   2024/04   »
1 2 3 4 5 6
7 8 9 10 11 12 13
14 15 16 17 18 19 20
21 22 23 24 25 26 27
28 29 30
글 보관함