Linux运行sudo apt-get update报错

时间:2024-03-25 08:38:54

关于出现运行报错如下

Err:1 http://mirrors.aliyun.com/ubuntu xenial InRelease
Temporary failure resolving ‘mirrors.aliyun.com’
Err:2 http://mirrors.aliyun.com/ubuntu xenial-updates InRelease
Temporary failure resolving ‘mirrors.aliyun.com’
Err:3 http://mirrors.aliyun.com/ubuntu xenial-backports InRelease
Temporary failure resolving ‘mirrors.aliyun.com’
Err:4 http://mirrors.aliyun.com/ubuntu xenial-security InRelease
Temporary failure resolving ‘mirrors.aliyun.com’
Reading package lists… Done
W: Failed to fetch http://mirrors.aliyun.com/ubuntu/dists/xenial/InRelease Temporary failure resolving ‘mirrors.aliyun.com’
W: Failed to fetch http://mirrors.aliyun.com/ubuntu/dists/xenial-updates/InRelease Temporary failure resolving ‘mirrors.aliyun.com’
W: Failed to fetch http://mirrors.aliyun.com/ubuntu/dists/xenial-backports/InRelease Temporary failure resolving ‘mirrors.aliyun.com’
W: Failed to fetch http://mirrors.aliyun.com/ubuntu/dists/xenial-security/InRelease Temporary failure resolving ‘mirrors.aliyun.com’
W: Some index files failed to download. They have been ignored, or old ones used instead.

出现这个错误时,可以先查看自己vm的网络有没有开启,如下图则为没有开启的状态
Linux运行sudo apt-get update报错

如果是上面这个问题,请往下看
1.首先需要打开VMware的网络服务,右键我的电脑(此电脑) ->管理->服务和应用程序->服务。找到VMware DHCP Service和VMware NAT Service,将其服务打开(如果自己的电脑服务找不到下面这两个服务或者其中一个(仅限于vm正版软件,不是绿色版,在此条件下不小心删除这些服务的请看文章最后))。Linux运行sudo apt-get update报错
2.返回虚拟机就可以看到成功连接的样子了。
Linux运行sudo apt-get update报错
注意:如果没有看到下图的样子,请耐心等待一会或者按照如图步骤进行。
Linux运行sudo apt-get update报错

===========================================================
关于仅限于vm正版软件,不是绿色版,在此条件下不小心删除这些服务的解决方法
Linux运行sudo apt-get update报错
Linux运行sudo apt-get update报错

Linux运行sudo apt-get update报错