Adding Proxy Settings to Raspberry Pi

This guide describes how to access a network (e.g. the Internet) through a proxy server.


Documentation

Adding Proxy Settings to Raspberry Pi

In many cases you need to configure a proxy to be able to connect your Raspberry Pi to the internet. This guide will help you with that. 

Prerequisites

  1. This guide assumes that you're running Raspbian Jessie or a similar derivate (think Ubuntu) on your machine.

Setting up the system-wide proxy

  1. For setting the proxy system-wide we need to change the /etc/environment file. In this case "nano" was used as the text editor but you can also use your preffered one.
    sudo nano /etc/environment
  2. Substitute your own proxy information and add the following lines to the file and save them.
    http_proxy=http://proxy:port
    https_proxy=http://proxy:port
  3. Reboot your system and you should be all set up.
    sudo reboot
  4. Note: Implementing changes to the /etc/environment file is the proper way of setting the proxy. But in some cases this does not work, so you might consider implementing the changes also into the /etc/profile file.
    sudo nano /etc/profile
  5. Proceede as specified above and then it should work for you as well.

     

Configure "apt-get" for proxy

To be able to use "apt-get" we need to configure the proxy. For this we need to run the following steps:

  1. Create a new file with an editor (here: nano):
    cd /etc/apt/apt.conf.d
    sudo nano 10proxy
  2. Add one of the following lines, depending on whether or not an authentication needs to be included and replace the placeholders with your proxy information.
    Acquire::http::Proxy "http://proxy:port/";
    Acquire::http::Proxy "http://username:password@proxy:port/";
  3. Save and then reboot your Raspberry Pi and you should be able to run an update.

 

Does this project pique your interest?
Login or register on Imaginghub to join or follow this project.