Ubuntu 13.04 中 apt-get 管理器忽略代理设置

Ubuntu 13.04 中 apt-get 管理器忽略代理设置

我在公司网络中使用 Ubuntu 13.04,http 代理在我的用户帐户上运行良好,但我仍然无法使用 apt-get 安装或更新任何内容:

需要代理身份验证(Forefront TMG 需要授权才能完成请求。对 Web 代理过滤器的访问被拒绝。)

我在系统配置>网络>网络代理>手动正确配置了系统范围的代理,并且:env | grep proxy 显示具有正确设置的 http_proxy、https_proxy 变量。

但仍然 apt-get 仍然无法连接。

接下来要尝试什么?

答案1

编辑“/etc/apt/apt.conf”并添加以下条目:

Acquire::http::Proxy "http://username:password@proxyhost:port/";

参考链接

答案2

这可能与您组织中的 ISA 代理设置有关。我在为我的组织配置虚拟服务器时遇到了同样的问题。

打开终端。在终端中输入以下命令:

sudo nano /etc/apt/apt.conf

此命令旨在打开 apt.conf 文件并使其可用于配置。如果系统提示您输入密码,请输入密码。

将以下行添加到文件中:

Acquire::http::proxy "http://[username]:[password]@[proxy_address]:[port]";
Acquire::https::proxy "https:// [username]:[password]@[proxy_address]:[port]";
Acquire::ftp::proxy "ftp:// [username]:[password]@[proxy_address]:[port]";
Acquire::socks::proxy "[username]:[password]@[proxy_address]:[port]";

其中: 用户名 - 您的代理用户名 密码 - 您的代理密码 proxy_address - 代理服务器的地址 端口 - 地址服务器上允许流量通过的端口

保存 apt.conf 文件。尝试运行 apt-get 命令,它应该会给出与此类似的内容

sudo apt-get install [package]
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following extra packages will be installed:
………
Do you want to continue? [Y/n] y:

如果您看到此响应,则意味着该软件包已准备好安装。

相关内容