4

I'm running Ubuntu 12.04 server inside my company network. It requires a proxy in order to access network outside. I configured the proxy during installation. After that, I found my proxy setting was saved in /etc/apt/apt.conf. But it's not in environment variables. However, wget is also able to download a web page through proxy. Where does wget (and other programs) read my proxy setting?

4 Answers 4

8

As usual I suppose nobody cared to integrate all the communications settings for the programs used in Linux/Ubuntu, which is a pity.

In 11.10 you have system wide settings in several locations:

/etc/environment

...
http_proxy="user:[email protected]:port
...

/etc/apt/apt.conf.d/02/proxy

The command apt has its settings in this file:

Acquire::http::proxy "http:/user:[email protected]:port"

/etc/wgetrc

The command wget has its settings in this file following the same format as the /etc/environment file mentioned above.

http_proxy="user:[email protected]:port

Provided 12.04 has the same file configuration as 11.10 regarding these three programs you can edit these files for the server.

I had a script file to change all these things in 11.10 back and forth between my work and home, but now I am not using that script until I know more details about how 12.04 works with these issues.

3

wget uses /etc/wgetrc in which you'll find HTTP and HTTPS proxy lines to uncomment and edit with your proxy settings.

1

Many of the linux command lines can make use of the environment variables http_proxy and ftp_proxy. Just set these in your .bashrc file or setup a shell script to set these environment variables prior to running commands such as apt or wget etc.

export http_proxy=http://proxyserver:port/
export ftp_proxy=http://proxyserver:port/
0

wget, and many other programs, get proxy information from the http_proxy environment variable. Try the command echo $http_proxy in a shell to make it is set.

1
  • 1
    wget maybe but not apt-get (on 12.04.1)
    – majkinetor
    Dec 5, 2012 at 15:34

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .