You usually either have the proxy server as user:password@host:port
or an automatic configuration script like http://some-script-path
Getting Browsers to work:
You would expect that the only setting that needs to be changed is at the ‘Network Proxy’ settings, and then press the ‘Apply system wide’.
[Ubuntu Oneiric Ocelot] System Settings > Network > Network Proxy
[Ubuntu older that Ocelot] System > Preferences > Network Proxy
That is usually enough to get the browser working. However,in my experience this is not enough to get ‘apt-get’, Ubuntu Software Centre, Update manager to work.
Getting ‘apt-get’ to work:
In order to get these working you have to create /etc/apt/apt.conf (if it does not already exist, which in my case never did), and add the following lines to it:
Acquire::http::Proxy "http://user:password@host:port/";
Acquire::ftp::Proxy "http://user:password@host:port/";
Retrieving “host:port” from automatic proxy configuration script:
If you are using an automatic configuration script like ‘http://some-script-path’ then open a terminal and type
wget http://some-script-path
This should save the script in your current working directory. Look into the script, and try to understand the host:port value it is trying to return for your IP address.
Look for statements like:
return "PROXY host1:port1; PROXY host2:port2";
You just need to use one of them. If you cannot determine one of the ‘host:port’s returned by the automatic configuration script then it is out of my scope. I do not know how to configure Ubuntu so that ‘apt-get’, Ubuntu Software Centre, Upgrade manager etc. can make use of automatic proxy configuration script. I think it just does not support this as of this writing.
To know your current IP address try the following command:
/sbin/ip addr show
Setting http_proxy variable:
Certain programs may still fail to work properly. For example, Dropbox could not download its proprietary daemon. To make all things work properly run the following command.
echo export http_proxy=http://user:passwd@host:port/ >> ~/.profile
Then logout, and log back in.
Do not rely on the ping command to verify if your proxy settings are working properly for reasons explained here.