执行 wget 命令时代理权限被拒绝

执行 wget 命令时代理权限被拒绝

我尝试通过命令行安装 gfortran。结果是

premkr@premkr-Lenovo-ideapad-100-15IBD:~$ sudo wget gfortran
[sudo] password for premkr: 
--2016-10-29 01:07:36--  http://gfortran/
Connecting to 10.10.78.21:3128... connected.
Proxy request sent, awaiting response... 503 Service Unavailable
2016-10-29 01:07:36 ERROR 503: Service Unavailable.

这是否意味着我的终端无法访问互联网。我的代理在 Firefox 中运行,并且连接良好。

答案1

要让您的终端和 wget 通过代理访问互联网,您必须编辑以下文件:

/etc/bash.bashrc
/etc/environment
/etc/wgetrc

其中必须包含以下参数:

/etc/bash.bashrc

export http_proxy=http://username:[email protected]:port/
export https_proxy=http://username:[email protected]:port/
export ftp_proxy=http://username:[email protected]:port/

/etc/环境

http_proxy=http://username:[email protected]:port/
https_proxy=http://username:[email protected]:port/
ftp_proxy=http://username:[email protected]:port/

/etc/wgetrc:

http_proxy=http://username:[email protected]:port/
https_proxy=http://username:[email protected]:port/
ftp_proxy=http://username:[email protected]:port/
use_proxy = on

编辑于 2016-08-11

要编辑文件(而不是目录),您必须:

打开终端,

Ctrl++AltT

运行:

exec sudo -i
nano /etc/bash.bashrc
nano /etc/environment
nano /etc/wgetrc

为了添加上述行,其中:

username = your username for the proxy if it exists
password = your password for the proxy if it exists
proxyserver.net = name or IP address of the proxy
port = port number of the proxy

相关内容