很多小伙伴在使用wget时会出现无法解析情况,下面来看一下“wget: 无法解析主机地址”的解决方法:

解决方法:

[root@iZ2zefny2a19ms6azli2pwZ~]#sudovim/etc/resolv.conf

修改服务器名称:

optionstimeout:2attempts:3rotatesingle-request-reopen;generatedby/usr/sbin/dhclient-script#nameserver100.100.2.138#nameserver100.100.2.136nameserver8.8.8.8nameserver8.8.8.4

再次下载:

[root@iZ2zefny2a19ms6azli2pwZ~]#wgethttps://download.redis.io/releases/redis-5.0.10.tar.gz–2021-10-0914:33:13–https://download.redis.io/releases/redis-5.0.10.tar.gz正在解析主机download.redis.io(download.redis.io)…45.60.125.1正在连接download.redis.io(download.redis.io)|45.60.125.1|:443…已连接。已发出HTTP请求,正在等待回应…200OK长度:1990507(1.9M)[application/octet-stream]正在保存至:“redis-5.0.10.tar.gz”100%[========================================================================================>]1,990,50713.3KB/s用时2m20s2021-10-0914:35:35(13.9KB/s)-已保存“redis-5.0.10.tar.gz”[1990507/1990507])[root@iZ2zefny2a19ms6azli2pwZ~]#