代理对浏览器有用,但对 wget 或 apt update 不起作用

代理对浏览器有用,但对 wget 或 apt update 不起作用

也可以看看https://stackoverflow.com/q/57206176/287948


该解决方案使用visudo我正在通过浏览器导航...但是wget不起作用sudo apt update

Ign:1 http://qgis.org/debian bionic InRelease
Ign:2 http://apt.postgresql.org/pub/repos/apt bionic-pgdg InRelease
...
Err:9 http://us.archive.ubuntu.com/ubuntu bionic Release
  Unsupported proxy configured: 80698092://http
Err:10 http://us.archive.ubuntu.com/ubuntu bionic-updates Release
  Unsupported proxy configured: 80698092://http

Lendo listas de pacotes... Pronto
E: The repository 'http://us.archive.ubuntu.com/ubuntu bionic Release' no longer has a Release file.
N: Updating from such a repository can't be done securely, and is therefore disabled by default.
N: See apt-secure(8) manpage for repository creation and user configuration details.

...
N: See apt-secure(8) manpage for repository creation and user configuration details.

任何 URL 对于浏览器有效,但对于获得, 例如:

wget http://us.archive.ubuntu.com/ubuntu/dists/bionic/Release“代理 URL 错误 ftp://myUser/myPassword@http://etc:需要 HTTP”. 同上wget http://google.com,或任何其他 URL。


笔记

变量存在,echo $http_proxy存在并且显示

https_proxy=http://user:etc%23etc@pac._ProxyDomain_/proxy.pac:8080
http_proxy=http://user:etc%23etc@pac._ProxyDomain_/proxy.pac:8080
no_proxy=localhost,127.0.0.0/8,::1
NO_PROXY=localhost,127.0.0.0/8,::1
ftp_proxy=http://user:etc%23etc@pac._ProxyDomain_/proxy.pac:8080

~/.profile生成的,

http_proxy="http://user:etc%23etc@pac._ProxyDomain_/proxy.pac:8080"
https_proxy="http://user:etc%23etc@pac._ProxyDomain_/proxy.pac:8080"
ftp_proxy="http://user:etc%23etc@pac._ProxyDomain_/proxy.pac:8080"

export http_proxy
export https_proxy
export ftp_proxy

(和我之前也测试过 myUser:myPassword@http://etc导致的错误)

它对浏览器很有用....但终端似乎对#我的密码字符有问题(是吗?)。


尝试使用sudo nano /etc/apt/apt.conf.d/80proxy (创建新文件)解决方案,

但系统忽略了它。

答案1

您正在使用

http_proxy="myUser:myPassword@http://etc"
https_proxy="myUser:myPassword@http://etc"
ftp_proxy="myUser:myPassword@http://etc"

正确的格式是

http_proxy="http://user:password@hostname:portnumber/"
https_proxy="http://user:password@hostname:portnumber/"
ftp_proxy="http://user:password@hostname:portnumber/"

相关内容