how to configure proxy server in linux

Proxy server is an interface that allows you to connect or use a service (usually a remote resource) that is usually resource intensive. It is also used by large area network to manage network traffic and as a security measure within the network.

When configuring a linux system for networking, you will also need to configure your proxy server, ie. if you use a proxy server in order to have a working network (or internet) connection. Most desktop environments such as KDE or Gnome provide you with an user interface that allow you to easily configure your proxy server.

Although that will work in most cases with application that need an internet connection, it is not always guaranteed that you will have a desktop environment. You might also need to some command line utilities that require internet connection such as wget, curl or links.

In Linux, you can configure or set environment variables, such as that all of the applications and utilities can read and use it. There are several different variables that you can set, to use the appropriate server for each protocol: http_proxy, https_proxy, ftp_proxy, socks_proxy, rsync_proxy, all_proxy and no_proxy.

Many times these variable names are specified in all caps, you can use either and most systems should pick up either of them.

Depending on your distro and application, some of the above mentioned variables may not be used. The variables follows the general pattern of 'protocol_proxy'…

These variables are set (and unset) just as any other environment variables in the system. Again, this can be set for every session, each user or set system wide (globally). The general usage would look something like this:

export http_proxy="http://proxy.us.server.com:80"
export https_proxy="http://proxy.us.server.com:80"
export ftp_proxy="http://proxy.us.server.com:80"
export no_proxy="localhost,127.0.0.1,localaddress"

You can set this in the .bashrc or .bash_profile file in the home directory for the user. In order to set this system wide you can modify the etc/profile file, include these in there. In a Gentoo environment, you can set global environment values in a file inside the /etc/env.d folder. There are several different profile files in the etc folder, such profile, profile.csh, profile.env etc etc. Also, there are configuration files inside the etc/profile.d folder, all of which can be used.

If you use Ubuntu or an Ubuntu based distro, then the global variables are set in the /etc/environment file. You can also look inside the etc/profile.d folder, which can several files including .sh file that are executed. The same format is used in other distros as well such CentOS. In Suse based systems, also look for a file called /etc/profile.local.