Linux不支持的代理配置

13

我是 Linux 新手,刚开始使用 Debian。我尝试安装 g++,但是

apt-get install g++

但它没有起作用

root@HP:/home/krzysztof# apt-get install g++
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following additional packages will be installed:
  g++-6 libstdc++-6-dev
Suggested packages:
  g++-multilib g++-6-multilib gcc-6-doc libstdc++6-6-dbg libstdc++-6-doc
The following NEW packages will be installed:
  g++ g++-6 libstdc++-6-dev
0 upgraded, 3 newly installed, 0 to remove and 0 not upgraded.
Need to get 8,516 kB of archives.
After this operation, 39.8 MB of additional disk space will be used.
Do you want to continue? [Y/n] Y
Err:1 http://ftp.pl.debian.org/debian stretch/main amd64 libstdc++-6-dev             amd64 6.3.0-18+deb9u1
  Unsupported proxy configured: 127.0.0.1://8888
Ign:2 http://ftp.pl.debian.org/debian stretch/main amd64 g++-6 amd64     6.3.0-18+deb9u1
Err:3 http://ftp.pl.debian.org/debian stretch/main amd64 g++ amd64 4:6.3.0-4
  Unsupported proxy configured: 127.0.0.1://8888
Err:1 http://security.debian.org/debian-security stretch/updates/main     amd64 libstdc++-6-dev amd64 6.3.0-18+deb9u1
  Unsupported proxy configured: 127.0.0.1://8888
Err:2 http://security.debian.org/debian-security stretch/updates/main     amd64 g++-6 amd64 6.3.0-18+deb9u1
  Unsupported proxy configured: 127.0.0.1://8888
E: Failed to fetch http://security.debian.org/debian-    security/pool/updates/main/g/gcc-6/libstdc++-6-dev_6.3.0-18+deb9u1_amd64.deb          Unsupported proxy configured: 127.0.0.1://8888
E: Failed to fetch http://security.debian.org/debian-    security/pool/updates/main/g/gcc-6/g++-6_6.3.0-18+deb9u1_amd64.deb      Unsupported proxy configured: 127.0.0.1://8888
E: Failed to fetch http://ftp.pl.debian.org/debian/pool/main/g/gcc-    defaults/g++_6.3.0-4_amd64.deb  Unsupported proxy configured:     127.0.0.1://8888
E: Unable to fetch some archives, maybe run apt-get update or try with --    fix-missing?

4
此问题不属于讨论范围,应移至SuperUser - https://superuser.com/ - sɐunıɔןɐqɐp
Stack Overflow是一个关于编程和开发问题的网站。这个问题似乎不属于编程或开发范畴。请参阅帮助中心中的我可以在这里问什么样的问题。也许超级用户Unix&Linux Stack Exchange更适合提问。 - jww
4个回答

51
"//"是提示您在代理配置的开头未添加"http://"的线索。例如:"
Acquire::http::Proxy "127.0.0.1:8888/"

会出现错误 Unsupported proxy configured: 127.0.0.1://8888,但是

Acquire::http::Proxy "http://127.0.0.1:8888/"

将正确设置代理


嗨,它在哪里,一些配置文件吗? - Peter Krauss
2
@PeterKrauss 文件是 /etc/apt/apt.conf,如果文件不存在可以创建它。 - xonya

1
创建文件 /etc/apt/apt.conf 并添加以下内容:
 "http://<IP>:<PORT>/";

1

我已经设置了环境变量 http_proxyhttps_proxy

在这里检查它们:

echo $http_proxy
echo $https_proxy

然后取消它们:

unset $http_proxy
unset $https_proxy

-4
错误信息显示:

配置了不支持的代理:127.0.0.1://8888

因此,看起来您(或其他人)配置了虚假的代理服务器,最可能应该是 127.0.0.1:8888(没有斜杠(//))。
您需要在 apt.conf(5)/etc/apt/apt.conf/etc/apt/apt.conf.d/)或通过 http_proxy 环境变量中更改这些值。

我没有apt.conf(5)文件。 - Krzysztof Ostrowski
apt.conf(5)通常是指向apt.conf手册页的常规方式 - 我已更新答案以包括链接。 - umläute
不是我 <3<3 - Krzysztof Ostrowski
1
错误信息甚至指出,如果代理变量不包含名称和端口之间的斜杠,则会出现此问题。原因是缺少协议说明符。 - vlad_tepesch
请查看我去年八月份发布的答案,那是正确的。这个被接受的答案是不正确的。 - marsbard

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接