If you are wondering how you can tell your Linux applications to use a proxy, then you have found the right article and as you will find out, it is surprisingly simple. After you set the proxy in linux, any applications such as wget, lynx and ftp will then be redirected through the proxy.
There are two settings you can make. One for web (http_proxy) and the other is ftp (ftp_proxy). We do this by setting each one in our environment variable.
Setup Proxy in Linux
Here is the most basic setup below. It will set an environment variable called http_proxy and ftp_proxy which will cause all your applications to redirect through the proxy.
export http_proxy='http://example.com' export ftp_proxy='ftp://example.com'
Export Proxy Username Password Linux
Here we set the username and password for the proxy by passing it before the domain and seperate with a colon.
export http_proxy='http://user:firstname.lastname@example.org' export ftp_proxy='ftp://user:email@example.com'
Set A Different Port To Use With The Proxy
Your proxy can run on a different port, so to select an alternate port, you can pass the port number after the domain. Below we select 8080 as the port for our proxy.
export http_proxy='http://example.com:8080' export ftp_proxy='http://example.com:8080'
Make Linux Proxy Export Permanent
Something to be aware of, is that setting this environment variable only makes it available until you log out. If you would like to make the export proxy setting permanent, then add any of the lines above to your .bashrc or .profile file in your home directory which is found under /home/yourfolder/.bashrc or /home/yourfolder/.profile or ~/.bashrc or ~/.profile (since ~ is just a shortcut to your home directory). Now each time you login, it will automatically set this environment variable for you but not any other users.
Set Proxy For All Users
In order to setup the proxy for all users on your Linux system, you need to set the export the environment variable to all users when they login by adding a line to /etc/bash.bashrc. Now when any user logs in, they will automatically have the proxy setup for them.