-->

Tuesday, March 19, 2013

Setting System-wide proxies in ubuntu


From this excellent post


Ubuntu Studio, like Xubuntu, uses the XFCE desktop environment which does not contain a graphical settings tool to set systemwide proxies (unlike the default Ubuntu desktop environment, Unity).

1. Set up the proxy/proxies for most programs

  • Open the /etc/environment file with gksudo leafpad (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"
    

2. Then set up proxies for GTK3 programs such as Rhythmbox:

Some newer GTK3 programs such as Rhythmbox ignore the environment variables set above, and rely on Gnome settings instead. To make sure they are covered, open a terminal and paste the below line-by-line, modifying as appropriate:
gsettings set org.gnome.system.proxy mode 'manual' 
gsettings set org.gnome.system.proxy.http host 'myproxy.server.com'
gsettings set org.gnome.system.proxy.http port 8080

3. Finally, set up the proxies for apt-get and Update Manager

  • These programs will not obey the environment variables either. Create a file called 95proxies in/etc/apt/apt.conf.d/, and include the following:
    Acquire::http::proxy "http://myproxy.server.com:8080/";
    Acquire::ftp::proxy "ftp://myproxy.server.com:8080/";
    Acquire::https::proxy "https://myproxy.server.com:8080/";
    
Finally, logout and reboot to make sure the changes take effect.

No comments:

Post a Comment