How to Configure Proxy Settings in Linux


Here are two different ways to configure Linux to recognize a proxy server or proxy configuration file.

Export Command for Proxy Environment Variables

Personal kneeling in stone tunnel, photo credit jondoe via flickr

photo credit: jondoe

Use the following commands to configure your proxy for http and ftp traffic on the command line
export http_proxy=http://: export ftp_proxy=http://:

If your proxy requires login/authentication, you can use the format:
export http_proxy=http://username:password@::

To have this applied every time you log in, place these lines in your .bashrc in your home (~) directory.
export http_proxy=http://:
export ftp_proxy=http://:

Network Proxy Settings

For GNOME, go to Computer->Desktop Preferences->Network Proxy
For KDE desktop manager, you can get to the network proxy settings under System Settings > Network Settings > Proxy

In the setting, you can configure either by your proxy server and port, by the network, or a file via a URL/file location (e.g. http://myproxyserver:port/proxyfile.pac) .

These settings work with most other applications (e.g. other browsers like Chrome, OS commands).

Program/Application Level

Some applications and commands need to be configured individually. Below are some common examples.

Firefox

You can manually set up the Firefox proxy in Options menu. Go to Options > Advanced > Settings.

Fedora – Yum Package Manager

yum proxy settings can be found in the file system at
/etc/yum.conf

Add a line to the file with the following information:
proxy=http://:
The next time you run yum, it will pick up that proxy.

For Ubuntu

Here is a similar how to article on configuring proxy settings in Ubuntu covering Synaptic Package Manager, Gnome, apt-get, and Firefox.

6 thoughts on “How to Configure Proxy Settings in Linux

  1. Pingback: Proxy Servers | Linux Academy

    • hi frostwong, that’s an awesome question with several answers.

      First we have to understand http_proxy and ftp_proxy are *environment variables* used by the shell (e.g. bash, sh) that can be set on the local user level and global level. The variables are an easy way to share configuration settings between multiple Linux applications and processes. The export command sets those variables.

      You could set the shell environment variables using the export command in various files such as ~/.bash_profile or ~/.profile or /etc/profile (the exact names of these files may vary with the Linux distribution). By adding those export statements to the profile files, the variables will be set up for your local user session or all global sessions.

      Remember some applications like the Fedora yum package manager store their own proxy settings in an application file, so you can modify the setting in that application’s configuration file.

      Learn more about environment variables and other system configuration files here: https://wiki.archlinux.org/index.php/environment_variables
      The article explains them from a general Linux perspective.

  2. Please, don’t call a “system-wide proxy” once you need to configure every single application/library to read from an environment variable. Windows have a system-wide proxy, Linux does not.

    • Hi Bruno, thanks for your comment and clarification. I’ve corrected the article to reflect Linux environment variables and remove references to a system proxy.

    • Fiddler2 runs with mono on Linux. You can CATCH all your system net activity and process it the way you want. To add a system-wide proxy use a syntax like:
      if (oSession.HostnameIs(“test.example.com”)) { // OR define a button to enable/disable
      oSession[“x-OverrideGateway”] = “socks=127.0.0.1:3128”; // or the IP you use, local or remote
      }

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s