Ubuntu How do I configure proxies without GUI?

Source: Internet
Author: User

Idea: My idea is to be a domestic Ubuntu cloud host can be used in another foreign (Singapore) server, to achieve access to Google, haha, better check information:)

The following procedure to modify the/etc/environment file, and then restart reboot this server, found Apt-get install software will also go this agent to install software,

, haha, this domestic server is inaccessible, some software that cannot be installed can be installed!!! Whoa, whoa. :)

-------------------------------------------------------How do I configure proxies without GUI?
2 Answersactiveoldestvotes
Up vote84down vote

System-wide proxies in CLI Ubuntu/server must bes set as environment variables.

  • Open the /etc/environment file with vi (or your favorite editor). This file stores the System-wide variables initialized upon boot.
  • Add the following lines, modifying appropriately. You must duplicate in both Upper-case and lower-case because (unfortunately) some programs only look for one or the other:

    Http_proxy= "http://myproxy.server.com:8080/" https_proxy= "http://myproxy.server.com:8080/" ftp_proxy= "http// myproxy.server.com:8080/"no_proxy=" localhost,127.0.0.1,localaddress,.localdomain.com "HTTP_PROXY="/HTTP/ myproxy.server.com:8080/"https_proxy=" http://myproxy.server.com:8080/"ftp_proxy=" http://myproxy.server.com : 8080/"no_proxy=" localhost,127.0.0.1,localaddress,.localdomain.com "
  • apt-get, aptitude , etc. won't obey the environment variables when used normally with sudo . So separately configure them; Create a file called 95proxies /etc/apt/apt.conf.d/ in, and include the following:

    Acquire::http::p Roxy "http://myproxy.server.com:8080/"; Acquire::ftp::p Roxy "ftp://myproxy.server.com:8080/"; Acquire::https::p Roxy "https://myproxy.server.com:8080/";

Finally, logout and reboot to make sure the changes take effect.

Sources:1, 2. See 1 in particular for additional help, including a script to quickly turn on/off the proxies.

Ubuntu How do I configure proxies without GUI?

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.