Couldn't resolve host Name or service not known appears in Centos

I copied my virtual machine today and tried to install a gitlab,. When I installed it with yum, it appeared

.
Couldn"t resolve host mirrors.aliyun.com Name or service not known

it literally means that the domain name cannot be resolved
, but the ping Baidu domain name can be accessed, that is, when yum is installed, it cannot resolve
. How to solve it?

searched a long circle and found no answer to sf.

Mar.09,2021

find a solution, and the test is valid:

vim /etc/resolv.conf

then modify

nameserver 8.8.8.8

Sauce is fine

Menu