Ubuntu

刪除代理後無法更新

  • June 17, 2019

我在192.168.40.97:3142using中安裝了一個 apt 記憶體伺服器apt-cacher-ng。為了在我的筆記型電腦上使用它,我02proxy/etc/apt/apt.conf.d目錄中添加了一個文件,其中包含以下內容。

Acquire::http { Proxy "http://192.168.40.97:3142"; };

但是後來我想在沒有代理的情況下使用 apt,因為伺服器有一些問題。所以我刪除了02proxy文件並嘗試了apt update. 但它仍在嘗試連接到伺服器。

r2m@ssl-60:/etc/apt/apt.conf.d$ sudo apt update
Err:1 http://in.archive.ubuntu.com/ubuntu xenial InRelease
 Could not connect to 192.168.40.97:3142 (192.168.40.97). - connect (111:     Connection refused)
Err:2 http://in.archive.ubuntu.com/ubuntu xenial-updates InRelease
 Unable to connect to 192.168.40.97:3142:
Err:3 http://in.archive.ubuntu.com/ubuntu xenial-backports InRelease
 Unable to connect to 192.168.40.97:3142:
Err:4 http://security.ubuntu.com/ubuntu xenial-security InRelease
 Could not connect to 192.168.40.97:3142 (192.168.40.97). - connect (111: Connection refused)
Reading package lists... Done                   
Building dependency tree       
Reading state information... Done
6 packages can be upgraded. Run 'apt list --upgradable' to see them.
W: Failed to fetch http://in.archive.ubuntu.com/ubuntu/dists/xenial/InRelease  Could not connect to 192.168.40.97:3142 (192.168.40.97). - connect (111: Connection refused)
W: Failed to fetch http://in.archive.ubuntu.com/ubuntu/dists/xenial-updates/InRelease  Unable to connect to 192.168.40.97:3142:
W: Failed to fetch http://in.archive.ubuntu.com/ubuntu/dists/xenial-backports/InRelease  Unable to connect to 192.168.40.97:3142:
W: Failed to fetch http://security.ubuntu.com/ubuntu/dists/xenial-security/InRelease  Could not connect to 192.168.40.97:3142 (192.168.40.97). - connect  (111: Connection refused)
W: Some index files failed to download. They have been ignored, or old ones used instead.

刪除代理應該怎麼做?我在 Ubuntu 16.04 上使用它

Linux ssl-60 4.10.0-42-generic #46~16.04.1-Ubuntu SMP Mon Dec 4 15:57:59 UTC 2017 x86_64 x86_64 x86_64 GNU/Linux

Proxy檢查此文件中 是否有包含該單詞的行/etc/apt/apt.conf.d/70debconf

如果該單詞Proxy存在,請刪除該行並在執行命令後apt update

來源:https ://wiki.debian.org/AptConf

如果您不想apt-get使用代理,請使用apt-get

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

引用自:https://unix.stackexchange.com/questions/415231