Proxy settings not working

I just installed Ubuntu 11.10 with Wubi and I am currently on a campus that requires the usage of a proxy server. I went into System Settings/Network/Proxy Settings. Didn't work. I manually set the proxy in Firefox and I do have access to the internet; however, I cannot add apps or update Ubuntu. How can I fix it? Thanks


On my fresh install of Ubuntu 11.10 64bits, this worked for command line with apt and Ubuntu Software Center.

Create the file /etc/apt/apt.conf and put this line with your proxy settings :

Acquire::http::Proxy "http://login:password@yourproxyaddress:port";

example :

Acquire::http::Proxy "http://bob:123bob@bobproxy:8070";

Two steps are required to get internet fully working in a proxified environment:

Gnome

Provide the proxy URL to the gnome-network-properties:

enter image description here

Shell

Add following to /etc/environment:

ftp_proxy="ftp://username:[email protected]:8080/"
http_proxy="http://username:[email protected]:8080/"
https_proxy="https://username:[email protected]:8080/"

Or

Add following to your .bashrc:

export ftp_proxy="ftp://username:[email protected]:8080/"
export http_proxy="http://username:[email protected]:8080/"
export https_proxy="https://username:[email protected]:8080/"

Please note, however, in case if proxy environment variables are set in .bashrc, commands that are being executed under different user privileges will not have this variables set (sudo will fail, for example). To get past this you might need to modify .bashrc of these users as well. In case of sudo, it is enough to execute it with -i argument, so it will preserve existing environment (sudo -i apt-get update will actually work without modifying root's .bashrc file).


I'm going to presume that your proxy settings are a URL to a server somewhere on campus, which probably means that you are using a PAC script. If your proxy settings do not consist of a URL, ignore this answer.

Firefox should work fine if you set the system proxy settings to this URL and it is set to use system settings.

Alas, the system settings just deliver the script URL to applications querying what the proxy should be - while browsers, and other apps which share browser codebases (like Thunderbird) are quite happy with PAC scripts, most applications are not. This includes many of the core system applications.

If your proxy config is delivered via PAC script, the best thing to do is to download it using your browser, and read through it looking for the actual addresses and ports of your proxy servers. Then use these to populate the manual proxy settings, which should work for more applications.


It may seem strange, but installing Synaptic on 11.10 and configuring the proxy and authentication settings there fixed apt-get as well.

I tried lots of things before that, I set the proxy settings everywhere I could (system settings, /etc/apt.conf, /etc/apt.conf.d/*, gconf-editor, environment variables), but nothing helped - apt-get update still hanged and tcpdump was showing it was trying to directly access 91.189.92.180.80.

Changing the settings with Synaptic fixed that. I actually hate this obscurity, it resembles Windows. However, it worked for me.