Apt-Get proxy setting date of Ubuntu: 2010-06-07 Author: muzuiget
After upgrading to ubuntu10.04, we found that the apt-Get proxy settings have changed. We can use the "http_proxy" environment variable before 9.10 to enable apt-get to use the proxy.
export http_proxy=http://127.0.0.1:8000sudo apt-get update
Then it will be invalid in ubuntu10.04. It seems that APT-Get has been changed to not use this environment variable.
After a bit of depression, I finally found that there was an additional "system-wide" button in "Preferences"> "network proxy" (I used an English environment, I don't know how the Chinese language is translated. I will prompt you when the window is closed). After setting it here, Apt-Get can indeed use a proxy.
However, I still despise this improvement because I usually occasionally use proxies to update several warehouses that have been damaged by the wall (such as Dropbox and Tor) and do not want to use global proxies at all, it is annoying to switch the agent points n times.
So I studied it and found that the Proxy Settings Modified two files, one being "/etc/environment", which is the environment variable of the system, it defines "http_proxy" and other proxy environment variables. The other is "/etc/APT/apt. conf", which is the configuration of Apt. The content is as follows:
Acquire::http::proxy "http://127.0.0.1:8000/";Acquire::ftp::proxy "ftp://127.0.0.1:8000/";Acquire::https::proxy "https://127.0.0.1:8000/";
Obviously, I read the apt-get manual and found that the "-c" option can be used to specify the configuration file, that is, copy a copy as "~ /Apt_proxy.conf ", and then reset the" Network Proxy "back to the direct connection.
sudo apt-get -c ~/apt_proxy.conf update
You can use the proxy. APT-Get also has a "-o" option. You do not need to specify the configuration file if you directly set the variable with APT-Get. For example
sudo apt-get -o Acquire::http::proxy="http://127.0.0.1:8000/" update
(Reproduced in: http://www.cnblogs.com/babykick/archive/2011/03/25/1996004.html)