DOCUMENTATION > CONFIGURATION > USE-A-PROXY
Using a proxy server
If you want your Raspberry Pi to access the internet via a proxy server (perhaps
from a school or other workplace), you will need to con gure your Pi to use the
server before you can get online.
What you will need
You will need:
The IP address or hostname and port of your proxy server
A username and password for your proxy (if required)
Con guring your Pi
You will need to set up three environment variables ( http_proxy ,
https_proxy , and no_proxy ) so your Raspberry Pi knows how to access the
proxy server.
Open a terminal window, and open the le /etc/environment using nano:
sudo nano /etc/environment
Add the following to the /etc/environment le to create the
http_proxy variable:
export http_proxy="http://proxyipaddress:proxyport"
Replace proxyipaddress and proxyport with the IP address and port
of your proxy.
Note: if your proxy requires a username and password, add them using the
following format:
export http_proxy="http://username:password@proxyipaddress:proxyport"
Enter the same information for the environment variable https_proxy :
export https_proxy="http://username:password@proxyipaddress:proxyport"
Create the no_proxy environment variable, which is a comma-separated
list of addresses your Pi should not use the proxy for:
export no_proxy="localhost, 127.0.0.1"
Your /etc/environment le should now look like this:
export http_proxy="http://username:password@proxyipaddress:proxyport"
export https_proxy="http://username:password@proxyipaddress:proxyport"
export no_proxy="localhost, 127.0.0.1"
Press Ctrl + X to save and exit.
Update sudoers
In order for operations that run as sudo (e.g. downloading and installing
software) to use the new environment variables, you'll need to update sudoers .
Use the following command to open sudoers :
sudo visudo
Add the following line to the le so sudo will use the environment variables
you just created:
Defaults env_keep+="http_proxy https_proxy no_proxy"
Press Ctrl + X to save and exit.
Reboot
Reboot your Raspberry Pi for the changes to take effect.
You should now be able to access the internet via your proxy server.
VIEW/EDIT THIS PAGE ON GITHUB
READ OUR USAGE AND CONTRIBUTIONS POLICY
ABOUT US SUPPORT
About us Help
Our team Documentation
Governance Projects
Safeguarding Training
Our supporters Downloads
Jobs Research
Contact us FAQ
SIGN UP TO OUR NEWSLETTER
Your email here
SUBSCRIBE
RASPBERRY PI FOUNDATION
UK REGISTERED CHARITY 1129409
Privacy Cookies Trademark rules and brand guidelines