如何暂时禁用apt代理设置以安装软件包

问题描述 投票:0回答:1

Apt能够使用代理来安装其他软件包以及依赖项。我正在研究一个Python项目,我需要一些提供库的额外软件包。

---> sudo apt-get update
Err:1 http://security.ubuntu.com/ubuntu bionic-security InRelease
  Could not resolve 'proxy.internal'
Err:2 http://archive.ubuntu.com/ubuntu bionic InRelease
  Could not resolve 'proxy.internal'
Err:3 http://archive.ubuntu.com/ubuntu bionic-updates InRelease
  Could not resolve 'proxy.internal'
Err:4 http://archive.ubuntu.com/ubuntu bionic-backports InRelease
  Could not resolve 'proxy.internal'
Reading package lists... Done
W: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/bionic/InRelease  Could not resolve 'proxy.internal'
W: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/bionic-updates/InRelease  Could not resolve 'proxy.internal'
W: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/bionic-backports/InRelease  Could not resolve 'proxy.internal'
W: Failed to fetch http://security.ubuntu.com/ubuntu/dists/bionic-security/InRelease  Could not resolve 'proxy.internal'
W: Some index files failed to download. They have been ignored, or old ones used instead.

如何暂时禁用代理(不更改永久选项/设置)?优选地,从命令行。

proxy dependencies apt
1个回答
1
投票

在不更改永久设置的情况下临时禁用代理配置的最快方法是使用命令行选项,如下所示:

sudo apt-get -o Acquire::http::proxy=false install <package>

这为用户提供了开放/公共/家庭网络与具有代理的企业环境之间的移动性。从手册页:

   -o, --option
       Set a Configuration Option; This will set an arbitrary configuration option. The syntax is -o
       Foo::Bar=bar.  -o and --option can be used multiple times to set different options.
© www.soinside.com 2019 - 2024. All rights reserved.