为什么apt-get无法解析镜像?

Jak*_*iak 11 server apt

可能重复:
apt-get 更新无法获取文件,“临时失败解决……”错误

我知道这之前已经涵盖过,但我似乎无法解决我的问题。这是我的输出。

jake@KUBIE-SERVER:~$ sudo apt-get update
Err http://us.archive.ubuntu.com precise InRelease

Err http://us.archive.ubuntu.com precise-updates InRelease

Err http://us.archive.ubuntu.com precise-backports InRelease

Err http://security.ubuntu.com precise-security InRelease

Err http://archive.canonical.com precise InRelease

Err http://ppa.launchpad.net precise InRelease

Err http://archive.canonical.com precise Release.gpg
  Temporary failure resolving 'archive.canonical.com'
Err http://ppa.launchpad.net precise Release.gpg
  Temporary failure resolving 'ppa.launchpad.net'
Err http://security.ubuntu.com precise-security Release.gpg
  Temporary failure resolving 'security.ubuntu.com'
Err http://us.archive.ubuntu.com precise Release.gpg
  Temporary failure resolving 'us.archive.ubuntu.com'
Err http://us.archive.ubuntu.com precise-updates Release.gpg
  Temporary failure resolving 'us.archive.ubuntu.com'
Err http://us.archive.ubuntu.com precise-backports Release.gpg
  Temporary failure resolving 'us.archive.ubuntu.com'
Reading package lists... Done
W: Failed to fetch http://us.archive.ubuntu.com/ubuntu/dists/precise/InRelease

W: Failed to fetch http://us.archive.ubuntu.com/ubuntu/dists/precise-        updates/InRelease

W: Failed to fetch http://us.archive.ubuntu.com/ubuntu/dists/precise-  backports/InRelease

W: Failed to fetch http://security.ubuntu.com/ubuntu/dists/precise-security/InRelease

W: Failed to fetch http://archive.canonical.com/ubuntu/dists/precise/InRelease

W: Failed to fetch     http://ppa.launchpad.net/webupd8team/java/ubuntu/dists/precise/InRelease

W: Failed to fetch http://us.archive.ubuntu.com/ubuntu/dists/precise/Release.gpg    Temporary failure resolving 'us.archive.ubuntu.com'

W: Failed to fetch http://us.archive.ubuntu.com/ubuntu/dists/precise- updates/Release.gpg  Temporary failure resolving 'us.archive.ubuntu.com'

W: Failed to fetch http://us.archive.ubuntu.com/ubuntu/dists/precise-  backports/Release.gpg  Temporary failure resolving 'us.archive.ubuntu.com'

W: Failed to fetch http://security.ubuntu.com/ubuntu/dists/precise-  security/Release.gpg  Temporary failure resolving 'security.ubuntu.com'

W: Failed to fetch http://archive.canonical.com/ubuntu/dists/precise/Release.gpg    Temporary failure resolving 'archive.canonical.com'

W: Failed to fetch   http://ppa.launchpad.net/webupd8team/java/ubuntu/dists/precise/Release.gpg  Temporary  failure resolving 'ppa.launchpad.net'

W: Some index files failed to download. They have been ignored, or old ones used  instead.
Run Code Online (Sandbox Code Playgroud)

任何帮助是极大的赞赏。

小智 6

我有同样的错误。我本来以为它是一个错误/etc/apt/sources.list,但做了之后ping不仅security.ubuntu.com但是google.com还有,我发现,我的服务器是连接到网络,但没有达到外网。

我编辑/etc/network/interfaces并设置eth0DHCP而不是静态。然后我让我的路由器负责为服务器提供一个静态 IP。重新启动服务器,一切正常。

您可以在此处找到有关 IP 配置的更多信息。


Zuu*_*uul 4

您没有详细说明可能解释问题背后原因的周围情况。

据说,您似乎遇到了一些包管理问题,可能是由于您正在使用的镜像而导致,该镜像可能丢失或需要更新Precise您所请求的包。

尝试这个:

  1. 打开终端并输入:

    sudo nano /etc/apt/sources.list
    
    Run Code Online (Sandbox Code Playgroud)

    编辑您的源文件。

  2. 在最开始,添加以下行:

    deb mirror://mirrors.ubuntu.com/mirrors.txt precise main restricted universe multiverse
    deb mirror://mirrors.ubuntu.com/mirrors.txt precise-updates main restricted universe multiverse
    deb mirror://mirrors.ubuntu.com/mirrors.txt precise-backports main restricted universe multiverse
    deb mirror://mirrors.ubuntu.com/mirrors.txt precise-security main restricted universe multiverse
    
    Run Code Online (Sandbox Code Playgroud)

    这应该会告诉apt-get您根据您的地理位置自动为您选择镜子。

  3. 保存文件并更新您的来源:

    sudo apt-get update
    
    Run Code Online (Sandbox Code Playgroud)

这假设您没有遇到任何互联网连接或 DNS 问题。

希望这可以帮助。