Systemwide Proxy Settings for LinuxMint/Ubuntu forks

I’ve been building several new boxes based on linux variants and flavors lately at work (Centos6x, RHEL6.5, Ubuntu12.04-14.04Server/Desktop, SLES, etc) and always have to deal with the proxy settings. For the web, it’s a simple matter of changing the proxy settings in firefox. For APT, it’s a different matter. Doing a websearch yields varied results, some of which are temporary or partial fixes. Yes, that includes attempting to set them in network settings via gui.

What has consistently worked for LinuxMint (including v16 and v17rc), Ubuntu and others of that variant is to change the settings system-wide in a few areas, all of which need to be changed as root:

  1. apt-get setting
  2. environment variables
  3. settings for GTK3 based programs (Gnome desktop)

Apt-Get

gedit /etc/apt/apt.conf.d/95proxies

and add the following (edited for your proxy of course)

Acquire::http::proxy “http://yourproxy.server.com:8080/”;
Acquire::https::proxy “https://yourproxy.server.com:8080/”;
Acquire::ftp::proxy “ftp://yourproxy.server.com:8080/”;

If you need to authenticate, change the lines to read similar to:

Acquire::http::proxy “user:pass@yourproxy.server.com:8080/”;

 Environment

gedit /etc/environment

add/change to: (Some apps use case sensitivity, therefore it’s duplicated here to catch it either way)

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”

 GTK3

open a terminal window, change to root (sudo su) and enter/paste the following:

gsettings set org.gnome.system.proxy mode ‘manual’
gsettings set org.gnome.system.proxy.http host ‘yourproxy.server.com’
gsettings set org.gnome.system.proxy.http port 8080

When done, Reboot.  I’ve noticed that you do not need to reboot if you’re in a terminal running apt-get update but the gui Software Manager and others will not work until you do reboot.