Introduction: Setting Up Raspberry Pi for a Proxy Server

About: Known by the name, “Kanad Nemade”. Big nerd of robots. Wants to become a Robotics Engineer.

If you want your Raspberry Pi to access the internet via a proxy server, you will need to configure your Pi to use the server before you can access the internet. There are two methods by which you can setup proxy server. But, however in the first method the in-terminal downloads (like 'git clone' and 'wget') don't work and so this tutorial is focused on the second method which works flawlessly.
This process not only works for Raspbian but almost all other OS (Kali Linux, Ubuntu, etc) for Raspberry Pi.

Step 1: What You Will Require

1. Hostname or IP address and port of your Proxy server
2. Username or password (this requirement is not mandatory if your Proxy server don't require username and password)

Step 2: Configuring Your Raspberry Pi

You will need to set up three environment variables ("http_proxy", "https_proxy", and "no_proxy") so that your Raspberry Pi knows how to access the internet via proxy server.

Step 3: Creating Environment Variables

You will need to open a file "/etc/environment" using nano command.
Open the Terminal and type:
sudo nano /etc/environment
After the file is opened type:
1) if you don't have username and password, type:

export http_proxy="http://proxyipaddress:proxyport"
export https_proxy="http://proxy IP address:proxyport"
export no_proxy=" localhost,"

2) if your proxy server have a username and password, type:

export http_proxy="http://username:password@proxyipaddress:proxyport"
export https_proxy="http://username:password@proxyipaddress:proxyport"
export no_proxy="localhost,"

After this press:
to save and exit.

Step 4: Update Sudoers

For this to run as sudo (e.g. downloading and installing software) to use the new environment variables, you'll need to update sudoers.
Go ahead and type:
'sudo visudo'
Now locate the defaults section and add this line just below the last 'Defaults'
'Defaults env_keep+="http_proxy https_proxy no_proxy" '

1) Ctrl+x
2) y
3) enter
To save and exit.

Step 5: Reboot

Without reboot this changes will not work. So go ahead and reboot your Raspberry Pi.
And you are done. You should now be able to access internet via proxy server.
If you face any problem please let me know in the comments! :)

Step 6: About Myself

My name is Kanad Nemade. I am 15 years old. Big nerd Robots and Tech related things. This is my second Instructable post and so sorry for mistakes in grammar :D

Here is the link to my first post: