Apt-Get proxy settings for Ubuntu

Source: Internet
Author: User
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)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.