我正在尝试在Ubuntu虚拟机上运行apt-get,但我不断收到连接和超时错误。因为设置了代理,我不确定是什么导致了它们。这是我的系统:
HOST: Win 7 Enterprise, SP1 (64-bit OS)
RAM: 8 GB
CPU: Intel i5 2.6GHz
VirtualBox 4.2.12
Ubuntu 64 (ubuntu-12.04.2-server-amd64.iso)
以下是工作流程及其产生的错误:
1)从GitBash(或任何其他* nix命令行)SSH到Ubuntu VM。注意:<localhost_alias>
已在主机文件中配置。
ssh -l<username> -p<ftp_port> <localhost_alias>
2)设置代理。我只需将这些文本文件中的这些文件复制粘贴到命令行上,然后按Enter键处理最后一个文件。
export http_proxy=http://proxy.somecorpdom:8080/
export https_proxy=https://proxy.somecorpdom:8080/
export no_proxy=localhost,127.0.0.1,*.somecorpdom
3)运行apt-get update。
sudo apt-get update
运行更新命令后,会立即显示以下内容,但会挂起几分钟:
0% [Connecting to us.archive.ubuntu.com (91.189.91.15)] [Connecting to security.ubuntu.com (91.189.92.202)]
最终消息消失了,我得到了这个(未删节):
Ign http://us.archive.ubuntu.com precise InRelease
Ign http://us.archive.ubuntu.com precise-updates InRelease
Ign http://us.archive.ubuntu.com precise-backports InRelease
Err http://us.archive.ubuntu.com precise Release.gpg
Unable to connect to us.archive.ubuntu.com:http: [IP: 91.189.91.13 80]
Err http://us.archive.ubuntu.com precise-updates Release.gpg
Unable to connect to us.archive.ubuntu.com:http: [IP: 91.189.91.13 80]
Err http://us.archive.ubuntu.com precise-backports Release.gpg
Unable to connect to us.archive.ubuntu.com:http: [IP: 91.189.91.13 80]
Ign http://us.archive.ubuntu.com precise Release
Ign http://us.archive.ubuntu.com precise-updates Release
Ign http://us.archive.ubuntu.com precise-backports Release
Ign http://us.archive.ubuntu.com precise/main TranslationIndex
Ign http://us.archive.ubuntu.com precise/multiverse TranslationIndex
Ign http://us.archive.ubuntu.com precise/restricted TranslationIndex
Ign http://us.archive.ubuntu.com precise/universe TranslationIndex
Ign http://us.archive.ubuntu.com precise-updates/main TranslationIndex
Ign http://us.archive.ubuntu.com precise-updates/multiverse TranslationIndex
Ign http://us.archive.ubuntu.com precise-updates/restricted TranslationIndex
Ign http://us.archive.ubuntu.com precise-updates/universe TranslationIndex
Ign http://us.archive.ubuntu.com precise-backports/main TranslationIndex
Ign http://us.archive.ubuntu.com precise-backports/multiverse TranslationIndex
Ign http://us.archive.ubuntu.com precise-backports/restricted TranslationIndex
Ign http://us.archive.ubuntu.com precise-backports/universe TranslationIndex
23% [Connecting to security.ubuntu.com (91.189.91.14)]
Unable to connect to us.archive.ubuntu.com:http: [IP: 91.189.91.13 80]
Err http://us.archive.ubuntu.com precise/restricted Sources
Unable to connect to us.archive.ubuntu.com:http: [IP: 91.189.91.13 80]
Err http://us.archive.ubuntu.com precise/universe Sources
Unable to connect to us.archive.ubuntu.com:http: [IP: 91.189.91.13 80]
Err http://us.archive.ubuntu.com precise/multiverse Sources
Unable to connect to us.archive.ubuntu.com:http: [IP: 91.189.91.13 80]
Err http://us.archive.ubuntu.com precise/main amd64 Packages
Unable to connect to us.archive.ubuntu.com:http: [IP: 91.189.91.13 80]
Err http://us.archive.ubuntu.com precise/restricted amd64 Packages
Unable to connect to us.archive.ubuntu.com:http: [IP: 91.189.91.13 80]
Err http://us.archive.ubuntu.com precise/universe amd64 Packages
Unable to connect to us.archive.ubuntu.com:http: [IP: 91.189.91.13 80]
Err http://us.archive.ubuntu.com precise/multiverse amd64 Packages
Unable to connect to us.archive.ubuntu.com:http: [IP: 91.189.91.13 80]
Err http://us.archive.ubuntu.com precise/main i386 Packages
Unable to connect to us.archive.ubuntu.com:http: [IP: 91.189.91.13 80]
Err http://us.archive.ubuntu.com precise/restricted i386 Packages
Unable to connect to us.archive.ubuntu.com:http: [IP: 91.189.91.13 80]
Err http://us.archive.ubuntu.com precise/universe i386 Packages
Unable to connect to us.archive.ubuntu.com:http: [IP: 91.189.91.13 80]
Err http://us.archive.ubuntu.com precise/multiverse i386 Packages
Unable to connect to us.archive.ubuntu.com:http: [IP: 91.189.91.13 80]
Err http://us.archive.ubuntu.com precise-updates/main Sources
Unable to connect to us.archive.ubuntu.com:http: [IP: 91.189.91.13 80]
Err http://us.archive.ubuntu.com precise-updates/restricted Sources
Unable to connect to us.archive.ubuntu.com:http: [IP: 91.189.91.13 80]
Err http://us.archive.ubuntu.com precise-updates/universe Sources
Unable to connect to us.archive.ubuntu.com:http: [IP: 91.189.91.13 80]
Err http://us.archive.ubuntu.com precise-updates/multiverse Sources
Unable to connect to us.archive.ubuntu.com:http: [IP: 91.189.91.13 80]
Err http://us.archive.ubuntu.com precise-updates/main amd64 Packages
Unable to connect to us.archive.ubuntu.com:http: [IP: 91.189.91.13 80]
Err http://us.archive.ubuntu.com precise-updates/restricted amd64 Packages
Unable to connect to us.archive.ubuntu.com:http: [IP: 91.189.91.13 80]
Err http://us.archive.ubuntu.com precise-updates/universe amd64 Packages
Unable to connect to us.archive.ubuntu.com:http: [IP: 91.189.91.13 80]
Err http://us.archive.ubuntu.com precise-updates/multiverse amd64 Packages
Unable to connect to us.archive.ubuntu.com:http: [IP: 91.189.91.13 80]
Err http://us.archive.ubuntu.com precise-updates/main i386 Packages
Unable to connect to us.archive.ubuntu.com:http: [IP: 91.189.91.13 80]
Err http://us.archive.ubuntu.com precise-updates/restricted i386 Packages
Unable to connect to us.archive.ubuntu.com:http: [IP: 91.189.91.13 80]
Err http://us.archive.ubuntu.com precise-updates/universe i386 Packages
Unable to connect to us.archive.ubuntu.com:http: [IP: 91.189.91.13 80]
Err http://us.archive.ubuntu.com precise-updates/multiverse i386 Packages
Unable to connect to us.archive.ubuntu.com:http: [IP: 91.189.91.13 80]
Err http://us.archive.ubuntu.com precise-backports/main Sources
Unable to connect to us.archive.ubuntu.com:http: [IP: 91.189.91.13 80]
Err http://us.archive.ubuntu.com precise-backports/restricted Sources
Unable to connect to us.archive.ubuntu.com:http: [IP: 91.189.91.13 80]
Err http://us.archive.ubuntu.com precise-backports/universe Sources
Unable to connect to us.archive.ubuntu.com:http: [IP: 91.189.91.13 80]
Err http://us.archive.ubuntu.com precise-backports/multiverse Sources
Unable to connect to us.archive.ubuntu.com:http: [IP: 91.189.91.13 80]
Err http://us.archive.ubuntu.com precise-backports/main amd64 Packages
Unable to connect to us.archive.ubuntu.com:http: [IP: 91.189.91.13 80]
Err http://us.archive.ubuntu.com precise-backports/restricted amd64 Packages
Unable to connect to us.archive.ubuntu.com:http: [IP: 91.189.91.13 80]
Err http://us.archive.ubuntu.com precise-backports/universe amd64 Packages
Unable to connect to us.archive.ubuntu.com:http: [IP: 91.189.91.13 80]
Err http://us.archive.ubuntu.com precise-backports/multiverse amd64 Packages
Unable to connect to us.archive.ubuntu.com:http: [IP: 91.189.91.13 80]
Err http://us.archive.ubuntu.com precise-backports/main i386 Packages
Unable to connect to us.archive.ubuntu.com:http: [IP: 91.189.91.13 80]
Err http://us.archive.ubuntu.com precise-backports/restricted i386 Packages
Unable to connect to us.archive.ubuntu.com:http: [IP: 91.189.91.13 80]
Err http://us.archive.ubuntu.com precise-backports/universe i386 Packages
Unable to connect to us.archive.ubuntu.com:http: [IP: 91.189.91.13 80]
Err http://us.archive.ubuntu.com precise-backports/multiverse i386 Packages
Unable to connect to us.archive.ubuntu.com:http: [IP: 91.189.91.13 80]
Err http://us.archive.ubuntu.com precise/main Translation-en_US
Unable to connect to us.archive.ubuntu.com:http: [IP: 91.189.91.13 80]
Err http://us.archive.ubuntu.com precise/main Translation-en
Unable to connect to us.archive.ubuntu.com:http: [IP: 91.189.91.13 80]
Err http://us.archive.ubuntu.com precise/multiverse Translation-en_US
Unable to connect to us.archive.ubuntu.com:http: [IP: 91.189.91.13 80]
Err http://us.archive.ubuntu.com precise/multiverse Translation-en
Unable to connect to us.archive.ubuntu.com:http: [IP: 91.189.91.13 80]
Err http://us.archive.ubuntu.com precise/restricted Translation-en_US
Unable to connect to us.archive.ubuntu.com:http: [IP: 91.189.91.13 80]
Err http://us.archive.ubuntu.com precise/restricted Translation-en
Unable to connect to us.archive.ubuntu.com:http: [IP: 91.189.91.13 80]
Err http://us.archive.ubuntu.com precise/universe Translation-en_US
Unable to connect to us.archive.ubuntu.com:http: [IP: 91.189.91.13 80]
Err http://us.archive.ubuntu.com precise/universe Translation-en
Unable to connect to us.archive.ubuntu.com:http: [IP: 91.189.91.13 80]
Err http://us.archive.ubuntu.com precise-updates/main Translation-en_US
Unable to connect to us.archive.ubuntu.com:http: [IP: 91.189.91.13 80]
Err http://us.archive.ubuntu.com precise-updates/main Translation-en
Unable to connect to us.archive.ubuntu.com:http: [IP: 91.189.91.13 80]
Err http://us.archive.ubuntu.com precise-updates/multiverse Translation-en_US
Unable to connect to us.archive.ubuntu.com:http: [IP: 91.189.91.13 80]
Err http://us.archive.ubuntu.com precise-updates/multiverse Translation-en
Unable to connect to us.archive.ubuntu.com:http: [IP: 91.189.91.13 80]
Err http://us.archive.ubuntu.com precise-updates/restricted Translation-en_US
Unable to connect to us.archive.ubuntu.com:http: [IP: 91.189.91.13 80]
Err http://us.archive.ubuntu.com precise-updates/restricted Translation-en
Unable to connect to us.archive.ubuntu.com:http: [IP: 91.189.91.13 80]
Err http://us.archive.ubuntu.com precise-updates/universe Translation-en_US
Unable to connect to us.archive.ubuntu.com:http: [IP: 91.189.91.13 80]
Err http://us.archive.ubuntu.com precise-updates/universe Translation-en
Unable to connect to us.archive.ubuntu.com:http: [IP: 91.189.91.13 80]
Err http://us.archive.ubuntu.com precise-backports/main Translation-en_US
Unable to connect to us.archive.ubuntu.com:http: [IP: 91.189.91.13 80]
Err http://us.archive.ubuntu.com precise-backports/main Translation-en
Unable to connect to us.archive.ubuntu.com:http: [IP: 91.189.91.13 80]
Err http://us.archive.ubuntu.com precise-backports/multiverse Translation-en_US
Unable to connect to us.archive.ubuntu.com:http: [IP: 91.189.91.13 80]
Err http://us.archive.ubuntu.com precise-backports/multiverse Translation-en
Unable to connect to us.archive.ubuntu.com:http: [IP: 91.189.91.13 80]
Err http://us.archive.ubuntu.com precise-backports/restricted Translation-en_US
Unable to connect to us.archive.ubuntu.com:http: [IP: 91.189.91.13 80]
Err http://us.archive.ubuntu.com precise-backports/restricted Translation-en
Unable to connect to us.archive.ubuntu.com:http: [IP: 91.189.91.13 80]
Err http://us.archive.ubuntu.com precise-backports/universe Translation-en_US
Unable to connect to us.archive.ubuntu.com:http: [IP: 91.189.91.13 80]
Err http://us.archive.ubuntu.com precise-backports/universe Translation-en
Unable to connect to us.archive.ubuntu.com:http: [IP: 91.189.91.13 80]
23% [Connecting to security.ubuntu.com (91.189.91.14)]
它持续了很长一段时间在“23%”。再过几分钟后,将显示此输出:
W: Failed to fetch http://us.archive.ubuntu.com/ubuntu/dists/precise-backports/universe/binary-i386/Packages Unable to connect to us.archive.ubuntu.com:http: [IP: 91.189.91.13 80]
W: Failed to fetch http://us.archive.ubuntu.com/ubuntu/dists/precise-backports/multiverse/binary-i386/Packages Unable to connect to us.archive.ubuntu.com:http: [IP: 91.189.91.13 80]
W: Failed to fetch http://us.archive.ubuntu.com/ubuntu/dists/precise/main/i18n/Translation-en_US Unable to connect to us.archive.ubuntu.com:http: [IP: 91.189.91.13 80]
W: Failed to fetch http://us.archive.ubuntu.com/ubuntu/dists/precise/main/i18n/Translation-en Unable to connect to us.archive.ubuntu.com:http: [IP: 91.189.91.13 80]
W: Failed to fetch http://us.archive.ubuntu.com/ubuntu/dists/precise/multiverse/i18n/Translation-en_US Unable to connect to us.archive.ubuntu.com:http: [IP: 91.189.91.13 80]
W: Failed to fetch http://us.archive.ubuntu.com/ubuntu/dists/precise/multiverse/i18n/Translation-en Unable to connect to us.archive.ubuntu.com:http: [IP: 91.189.91.13 80]
W: Failed to fetch http://us.archive.ubuntu.com/ubuntu/dists/precise/restricted/i18n/Translation-en_US Unable to connect to us.archive.ubuntu.com:http: [IP: 91.189.91.13 80]
W: Failed to fetch http://us.archive.ubuntu.com/ubuntu/dists/precise/restricted/i18n/Translation-en Unable to connect to us.archive.ubuntu.com:http: [IP: 91.189.91.13 80]
W: Failed to fetch http://us.archive.ubuntu.com/ubuntu/dists/precise/universe/i18n/Translation-en_US Unable to connect to us.archive.ubuntu.com:http: [IP: 91.189.91.13 80]
W: Failed to fetch http://us.archive.ubuntu.com/ubuntu/dists/precise/universe/i18n/Translation-en Unable to connect to us.archive.ubuntu.com:http: [IP: 91.189.91.13 80]
W: Failed to fetch http://us.archive.ubuntu.com/ubuntu/dists/precise-updates/main/i18n/Translation-en_US Unable to connect to us.archive.ubuntu.com:http: [IP: 91.189.91.13 80]
W: Failed to fetch http://us.archive.ubuntu.com/ubuntu/dists/precise-updates/main/i18n/Translation-en Unable to connect to us.archive.ubuntu.com:http: [IP: 91.189.91.13 80]
W: Failed to fetch http://us.archive.ubuntu.com/ubuntu/dists/precise-updates/multiverse/i18n/Translation-en_US Unable to connect to us.archive.ubuntu.com:http: [IP: 91.189.91.13 80]
W: Failed to fetch http://us.archive.ubuntu.com/ubuntu/dists/precise-updates/multiverse/i18n/Translation-en Unable to connect to us.archive.ubuntu.com:http: [IP: 91.189.91.13 80]
W: Failed to fetch http://us.archive.ubuntu.com/ubuntu/dists/precise-updates/restricted/i18n/Translation-en_US Unable to connect to us.archive.ubuntu.com:http: [IP: 91.189.91.13 80]
W: Failed to fetch http://us.archive.ubuntu.com/ubuntu/dists/precise-updates/restricted/i18n/Translation-en Unable to connect to us.archive.ubuntu.com:http: [IP: 91.189.91.13 80]
W: Failed to fetch http://us.archive.ubuntu.com/ubuntu/dists/precise-updates/universe/i18n/Translation-en_US Unable to connect to us.archive.ubuntu.com:http: [IP: 91.189.91.13 80]
W: Failed to fetch http://us.archive.ubuntu.com/ubuntu/dists/precise-updates/universe/i18n/Translation-en Unable to connect to us.archive.ubuntu.com:http: [IP: 91.189.91.13 80]
W: Failed to fetch http://us.archive.ubuntu.com/ubuntu/dists/precise-backports/main/i18n/Translation-en_US Unable to connect to us.archive.ubuntu.com:http: [IP: 91.189.91.13 80]
W: Failed to fetch http://us.archive.ubuntu.com/ubuntu/dists/precise-backports/main/i18n/Translation-en Unable to connect to us.archive.ubuntu.com:http: [IP: 91.189.91.13 80]
W: Failed to fetch http://us.archive.ubuntu.com/ubuntu/dists/precise-backports/multiverse/i18n/Translation-en_US Unable to connect to us.archive.ubuntu.com:http: [IP: 91.189.91.13 80]
W: Failed to fetch http://us.archive.ubuntu.com/ubuntu/dists/precise-backports/multiverse/i18n/Translation-en Unable to connect to us.archive.ubuntu.com:http: [IP: 91.189.91.13 80]
W: Failed to fetch http://us.archive.ubuntu.com/ubuntu/dists/precise-backports/restricted/i18n/Translation-en_US Unable to connect to us.archive.ubuntu.com:http: [IP: 91.189.91.13 80]
W: Failed to fetch http://us.archive.ubuntu.com/ubuntu/dists/precise-backports/restricted/i18n/Translation-en Unable to connect to us.archive.ubuntu.com:http: [IP: 91.189.91.13 80]
W: Failed to fetch http://us.archive.ubuntu.com/ubuntu/dists/precise-backports/universe/i18n/Translation-en_US Unable to connect to us.archive.ubuntu.com:http: [IP: 91.189.91.13 80]
W: Failed to fetch http://us.archive.ubuntu.com/ubuntu/dists/precise-backports/universe/i18n/Translation-en Unable to connect to us.archive.ubuntu.com:http: [IP: 91.189.91.13 80]
W: Failed to fetch http://security.ubuntu.com/ubuntu/dists/precise-security/Release.gpg Unable to connect to security.ubuntu.com:http: [IP: 91.189.92.190 80]
W: Failed to fetch http://security.ubuntu.com/ubuntu/dists/precise-security/main/source/Sources Unable to connect to security.ubuntu.com:http: [IP: 91.189.92.190 80]
W: Failed to fetch http://security.ubuntu.com/ubuntu/dists/precise-security/restricted/source/Sources Unable to connect to security.ubuntu.com:http: [IP: 91.189.92.190 80]
W: Failed to fetch http://security.ubuntu.com/ubuntu/dists/precise-security/universe/source/Sources Unable to connect to security.ubuntu.com:http: [IP: 91.189.92.190 80]
W: Failed to fetch http://security.ubuntu.com/ubuntu/dists/precise-security/multiverse/source/Sources Unable to connect to security.ubuntu.com:http: [IP: 91.189.92.190 80]
W: Failed to fetch http://security.ubuntu.com/ubuntu/dists/precise-security/main/binary-amd64/Packages Unable to connect to security.ubuntu.com:http: [IP: 91.189.92.190 80]
W: Failed to fetch http://security.ubuntu.com/ubuntu/dists/precise-security/restricted/binary-amd64/Packages Unable to connect to security.ubuntu.com:http: [IP: 91.189.92.190 80]
W: Failed to fetch http://security.ubuntu.com/ubuntu/dists/precise-security/universe/binary-amd64/Packages Unable to connect to security.ubuntu.com:http: [IP: 91.189.92.190 80]
W: Failed to fetch http://security.ubuntu.com/ubuntu/dists/precise-security/multiverse/binary-amd64/Packages Unable to connect to security.ubuntu.com:http: [IP: 91.189.92.190 80]
W: Failed to fetch http://security.ubuntu.com/ubuntu/dists/precise-security/main/binary-i386/Packages Unable to connect to security.ubuntu.com:http: [IP: 91.189.92.190 80]
W: Failed to fetch http://security.ubuntu.com/ubuntu/dists/precise-security/restricted/binary-i386/Packages Unable to connect to security.ubuntu.com:http: [IP: 91.189.92.190 80]
W: Failed to fetch http://security.ubuntu.com/ubuntu/dists/precise-security/universe/binary-i386/Packages Unable to connect to security.ubuntu.com:http: [IP: 91.189.92.190 80]
W: Failed to fetch http://security.ubuntu.com/ubuntu/dists/precise-security/multiverse/binary-i386/Packages Unable to connect to security.ubuntu.com:http: [IP: 91.189.92.190 80]
W: Failed to fetch http://security.ubuntu.com/ubuntu/dists/precise-security/main/i18n/Translation-en_US Unable to connect to security.ubuntu.com:http: [IP: 91.189.92.190 80]
W: Failed to fetch http://security.ubuntu.com/ubuntu/dists/precise-security/main/i18n/Translation-en Unable to connect to security.ubuntu.com:http: [IP: 91.189.92.190 80]
W: Failed to fetch http://security.ubuntu.com/ubuntu/dists/precise-security/multiverse/i18n/Translation-en_US Unable to connect to security.ubuntu.com:http: [IP: 91.189.92.190 80]
W: Failed to fetch http://security.ubuntu.com/ubuntu/dists/precise-security/multiverse/i18n/Translation-en Unable to connect to security.ubuntu.com:http: [IP: 91.189.92.190 80]
W: Failed to fetch http://security.ubuntu.com/ubuntu/dists/precise-security/restricted/i18n/Translation-en_US Unable to connect to security.ubuntu.com:http: [IP: 91.189.92.190 80]
W: Failed to fetch http://security.ubuntu.com/ubuntu/dists/precise-security/restricted/i18n/Translation-en Unable to connect to security.ubuntu.com:http: [IP: 91.189.92.190 80]
W: Failed to fetch http://security.ubuntu.com/ubuntu/dists/precise-security/universe/i18n/Translation-en_US Unable to connect to security.ubuntu.com:http: [IP: 91.189.92.190 80]
W: Failed to fetch http://security.ubuntu.com/ubuntu/dists/precise-security/universe/i18n/Translation-en Unable to connect to security.ubuntu.com:http: [IP: 91.189.92.190 80]
E: Some index files failed to download. They have been ignored, or old ones used instead.
我支持企业防火墙/代理。
答案 0 :(得分:18)
我找到了答案。这是修复:
将这两行添加到/etc/apt/apt.conf
作为sudo
Acquire::http::proxy "http://somecorpdom:8080/";
Acquire::https::proxy "https://somecorpdom:8080/";
然后apt-get应该在你的Ubuntu中运行。 (将“somecorpdom”更改为您的代理人)
答案 1 :(得分:2)
您可以像以前一样导出代理:
export http_proxy=http://proxy.somecorpdom:8080/
export https_proxy=https://proxy.somecorpdom:8080/
然后尝试sudo -E apt-get update
。