当我把虚拟机IP改为静态的时候,发现yum下载东西不能用了,在使用的时候出现如下错误:
[root@slave1 ~]# yum install -y wget
Loaded plugins: fastestmirror
Could not retrieve mirrorlist http://mirrorlist.centos.org/?rel
14: curl#6 - "Could not resolve host: mirrorlist.centos.org; Un
One of the configured repositories failed (Unknown),
and yum doesn't have enough cached data to continue. At this p
safe thing yum can do is fail. There are a few ways to work "f
1. Contact the upstream for the repository and get them to
2. Reconfigure the baseurl/etc. for the repository, to poi
upstream. This is most often useful if you are using a
distribution release than is supported by the repositor
packages for the previous distribution release still wo
3. Run the command with the repository temporarily disable
yum --disablerepo=<repoid> ...
4. Disable the repository permanently, so yum won't use it
will then just ignore the repository until you permanen
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 i
Note that yum will try to contact the repo. when it run
so will have to try and fail each time (and thus. yum w
slower). If it is a very temporary problem though, this
compromise:
yum-config-manager --save --setopt=<repoid>.skip_if
Cannot find a valid baseurl for repo: base/7/x86_64
我的配置文件配置项:
找了一些原因,发现添加一个DNS服务器的配置项就可以了。
DNS1=8.8.8.8
DNS2=8.8.8.5 # 备用DNS
然后重启网关
[root@slave2 ~]# systemctl restart network
如果大家在配置的时候不知道自己的网关是多少的话可以有两种解决方式。
第一种:
使用命令:ip route
再出现的信息中可以找到网关信息
第二种:
在VmWare中依次点击:
编辑
–>虚拟网络编辑器
–>再出现的VMnet名称列表中选择VMnet8
–>点击NAT设置
在出现的弹窗中就可以看到网关是多少了。
然后我们在下载wget插件就发现可以了