How to configure system proxy settings in Red Hat Enterprise Linux

0
Here we will examine how to set proxy settings in RHEL 5 or 6.  This will also work for centOS 5 and 6 as well as most versions of Fedora.
proxy settings in Red Hat Enterprise
We will cover the following three topics:
  1. Setting the proxy via Gnome GUI
  2. Setting the proxy via command line
  3. Configuring YUM to use our proxy
Setting the proxy via Gnome GUI (Linux Control Panel Applet)
From your desktop click System > Preferences > Network Proxy
This will bring up the following dialog box.

Most companies that run a proxy server will offer an autoconfiguration URL.  This URL usually leads to a “proxy.pac” or “wpad.dat” on a web server.  This is the preferred way of offering a proxy configuration since it allows flexibility to the system administrator to dynamically change your settings.
If you have been provided an autoconfiguration URL you can enter it here.  If no URL has been provided check the “Manual proxy configuration” and enter the hostname and port for each protocol.

Learn more about WPAD (Web Proxy Autodiscovery Protocol) you can start with an overview here:
http://en.wikipedia.org/wiki/Web_Proxy_Autodiscovery_Protocol

Linux proxy settings differ from the way Windows handle’s proxy settings.  In Windows if you set the proxy in Internet Explorer then it is a system wide setting.  In Linux you will still need to tell other applications about your new proxy settings, including your browser.

Open Firefox (default web browser for RHEL) and select Preferences > Network > Connections.

Select the radio box that says “Use system proxy settings”.
Optionally you can also enter the same Autoconfiguration URL you used above in the “Automatic Proxy Configuration URL” box in the above screen. Another option is to set the proxy manually in the browser as well.
Setting the proxy via command line
In order to use HTTP/HTTPS proxy settings via the command line you will need to set the http_proxy environmental variable. The autoconfiguration URL you used above will not work when setting an environmental variable.
YOU MUST USE THE DIRECT FQDN FOR THE PROXY FOLLOWED BY THE PORT NUMBER.
You can set this via the command line like so:
[savona@devel ~]$ http_proxy=http://webserv.domain.com:8080
To confirm the variable is set correctly you can use the “echo” command:
[savona@devel ~]$ echo $http_proxy
http://webserv.domain.com:8080
Remember that if you set the variable via the command like described above it is only valid for the current shell. If you open a new shell, or logout the variable will be unset. To make this setting available in all future shell instances we can export the variable via the .bash_profile file.
Setting the proxy to be available in all shell instances.
NOTE: The .bash_profile file is a hidden file in your home directory.
In your favorite editor open the .bash_profile file for editing.
(example: vi ~/.bash_profile)
Add the following lines to the end of the file:
http_proxy=http://webserv.domain.com:8080
export http_proxy
NOTE: This must be done for each individual user, including root.
Configuring YUM to use proxy
To configure “yum” to use the HTTP / HTTPS proxy you will need to edit the /etc/yum.conf configuration file. Open /etc/yum.conf in your favorite editor and add the following line.
proxy=http://webserv.domain.com:8080
Save and close the file, then clear the cache used by yum with the following command:
yum clean all
Share.

About Author

Tauseef Emraj Shehan

Leave A Reply

Powered by themekiller.com