-
- Posts: 30
- Joined: Tue Jan 08, 2013 9:48 am
How to set Proxy Address
We have a pi for showing office stats etc on a nice big screen. However it can't connect to the internet as we need to set a proxy address for it. How do I do this?
- penguintutor
- Posts: 401
- Joined: Tue May 08, 2012 9:11 am
- Location: UK
Re: How to set Proxy Address
You can set a proxy through the environment variables http_proxy, https_proxy, ftp_proxy and no_proxy etc.
You can put these into /etc/profile (or if you prefer /etc/environment) to take effect system-wide.
eg. add the following lines to the bottom of /etc/profile
inserting the addresses / ports as appropriate.
Not every application will honour these, but most well designed apps do. Notably the Midori browser will honour the proxy statements (as long as enabled in the preferences), but ignores the no_proxy settings
Some applications allow you to configure the proxy manually - eg. midori preferences are reached through the down arrow near the top right > Menu > Preferences > Network. Here you can choose between using the environment settings, manual proxy or no proxy.
You can put these into /etc/profile (or if you prefer /etc/environment) to take effect system-wide.
eg. add the following lines to the bottom of /etc/profile
Code: Select all
export http_proxy="http://<proxyipaddress>:<proxyport>"
export https_proxy="http://<proxyipaddress>:<proxyport>"
export no_proxy="localhost,127.0.0.1,192.168.0.0/16"
Not every application will honour these, but most well designed apps do. Notably the Midori browser will honour the proxy statements (as long as enabled in the preferences), but ignores the no_proxy settings

Some applications allow you to configure the proxy manually - eg. midori preferences are reached through the down arrow near the top right > Menu > Preferences > Network. Here you can choose between using the environment settings, manual proxy or no proxy.
-
- Posts: 30
- Joined: Tue Jan 08, 2013 9:48 am
Re: How to set Proxy Address
I have set the proxy in etc/environment but apt still hangs and can't connect to the web.
If I use sudo apt-get -o Acquire::http::proxy 111.111.11.11:8080 update. Everything works fine so the proxy is working, apt just is not pulling the settings. How do I get apt working?
If I use sudo apt-get -o Acquire::http::proxy 111.111.11.11:8080 update. Everything works fine so the proxy is working, apt just is not pulling the settings. How do I get apt working?
- penguintutor
- Posts: 401
- Joined: Tue May 08, 2012 9:11 am
- Location: UK
Re: How to set Proxy Address
When using sudo the environment variables are normally reset as a security feature
Try adding the -E option to sudo to preserve your environment variables
eg.
to change this permanently you could either edit the sudoers file (visudo) and put the following in place of the current entry:
or perhaps a better way is to explicitly keep the proxy entries - eg. add entry
Try adding the -E option to sudo to preserve your environment variables
eg.
Code: Select all
sudo -E apt-get update
Code: Select all
Defaults !env_reset
Code: Select all
Defaults env_keep += "http_proxy"
Re: How to set Proxy Address
To get apt-get to work with a proxy every time, I did the following:
John
Code: Select all
sudo nano /etc/apt/apt.conf
# Add following line to file:
Acquire::http::Proxy “http://xxx.xxx.xxx.xxx:8080/”;Acquire::ftp::Proxy “ftp://xxx.xxx.xxx.xxx:8080/”;
NCR 310 - ZX81 - Apple II+ - Dell/Intel - Mac mini... Raspberry Pi!