In this tutorial, I am going to tell you how to connect raspberry pi to the proxy server.
As most of the colleges have internet connection through local ethernet having its own proxy settings so for downloading packages on raspi you have to set up local proxy settings.
Here are the simple steps for connecting raspi to the proxy server.
- Open Root Terminal (Ctrl+Alt+T) and then type:
1sudo nano /etc/apt/apt.conf.d/10proxy
This command creates a file named 10proxy and then add proxy settings to this file by typing:
12Acquire::http::Proxy "http://username:password@proxy_server_address:port/";Acquire::https::Proxy "http://username:password@proxy_server_address:port/";
and save it. You need to add in the exact format as written above (do not leave any semicolon or space). - Again in Root Terminal type:
1sudo nano /etc/environment
then add proxy settings to this file by typing:
123export http_proxy="http://username:password@proxy_server_address:port/"export https_proxy="http://username:password@proxy_server_address:port/"export no_proxy="localhost, 127.0.0.1"
and save it. If you want to know more about environment variables follow this link https://help.ubuntu.com/community/EnvironmentVariables - Again in Root Terminal type:
1sudo nano ~/.bashrc
This opens bash file scroll to the end of the file and type:
12export http_proxy=http://username:password@proxy_server_address:portexport https_proxy=https://username:password@proxy_server_address:port
and save it. If you want to know more about .bashrc follow this link https://askubuntu.com/questions/540683/what-is-a-bashrc-file-and-what-does-it-do - At last in Root Terminal type
1source ~/.bashrc - In order to download the file using sudo, update sudoers. First, open sudoers using
1sudo visudo
Then add the following line so that sudo is able to use the above environment variables
1Defaults env_keep+="http_proxy https_proxy no_proxy"
Reboot pi for the changes to work. - Then run the following command in the Root Terminal for checking if the internet is working
1sudo apt-get update
Hope this helps. Enjoy!!!