无法在我的虚拟机中安装软件包

无法在我的虚拟机中安装软件包

我刚刚在虚拟机中安装了 Ubuntu Server 16.04 LTS,但无法安装任何新软件包?我尝试删除源列表并进行更新,但同样的问题再次出现。我尝试了此命令行,但问题依然存在。

sudo apt-get clean
sudo apt-get update 
sudo apt-get upgrade --fix-missing

更新的输出是:

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

提前致谢

答案1

这似乎只是我犯的一个愚蠢的错误,我忘记在接口配置中添加 DNS 服务器名称,所以我的所有包都无法解析域名。

解决方案是:添加行

dns-nameservers 8.8.8.8

在文件上/etc/network/interfaces

相关内容