可能重复:
apt-get 不适用于代理
我尝试将终端中的代理设置更改为:
export HTTP_PROXY=http://10.1.3.1:8080
Run Code Online (Sandbox Code Playgroud)
和
export http_proxy=http://10.1.3.1:8080
Run Code Online (Sandbox Code Playgroud)
但是当我尝试安装新软件包或更新 apt-get 时,apt-get 开始显示似乎正在尝试连接到先前设置的代理的消息:
sudo apt-get update
0% [Connecting to 10.1.2.2 (10.1.2.2)] [Connecting to 10.1.2.2 (10.1.2.2)
Run Code Online (Sandbox Code Playgroud)
我曾尝试通过 bashrc 文件设置代理,但该 din 也可以工作。据我所知,10.1.2.2 是使用 GNOME GUI 设置的,但我现在无法访问 GUI,所以我试图从终端设置它。
Usm*_*man 66
好的刚刚解决了它。添加以下行/etc/apt/apt.conf已解决了问题:
Acquire::http::proxy "http://10.1.3.1:8080/";
如果文件不存在,则创建它。不要将它与 apt.conf.d 目录混淆。
Jul*_*ght 61
文件:
/etc/environment
Run Code Online (Sandbox Code Playgroud)
是指定应可用于所有进程的系统范围环境变量的正确位置。有关详细信息,请参阅https://help.ubuntu.com/community/EnvironmentVariables。请注意,这不是脚本文件,而是配置文件。
如果您只希望对指定的命令执行此操作,请使用(以 root 身份):
http_proxy=http://10.1.3.1:8080 apt-get update
Run Code Online (Sandbox Code Playgroud)
Lin*_*ill 13
编辑您的:
gedit /etc/profile
Run Code Online (Sandbox Code Playgroud)
以这种格式输入详细信息。
export http_proxy=http://username:password@proxyhost:port/
export ftp_proxy=http://username:password@proxyhost:port/
Run Code Online (Sandbox Code Playgroud)
然后运行
sudo apt-get update
Run Code Online (Sandbox Code Playgroud)
那应该为你做。
如上所述,您可以将代理输入 apt.conf (Piyush Credit)
| 归档时间: |
|
| 查看次数: |
610118 次 |
| 最近记录: |