RHEL add global proxy

Testing whether a proxy is set

This command will show if there is a proxy server configured on the system:

echo $http_proxy

Proxy setting for command line programs

The http_proxy environment variable is used to specify proxy settings to client programs such as curl and wget.

No username and password required:

export http_proxy=http://SERVER:PORT/

Username and password authentication:

export http_proxy=http://USERNAME:PASSWORD@SERVER:PORT/

Domain, username and password required:

export http_proxy=http://DOMAIN\\USERNAME:PASSWORD@SERVER:PORT/

Special character handling:

Literal backslash characters (\) need to be doubled:

export http_proxy=http://DOMAIN\\USERNAME:PASSWORD@SERVER:PORT/

When the username or password uses the @ symbol, add a backslash (\) before the @ – for example:

export http_proxy=http://DOMAIN\\USERN\@ME:PASSWORD@SERVER:PORT

or

export http_proxy=http://DOMAIN\\USERNAME:P\@SSWORD@SERVER:PORT

Making this permanent

For bash and sh users, add the export line given above into a new file called /etc/profile.d/http_proxy.sh file:

# echo "export http_proxy=http://proxy.example.com:3128/" > /etc/profile.d/http_proxy.sh

For csh and tcsh users, use the following command to set the http_proxy variable in a new file called /etc/profile.d/http_proxy.csh file:

# echo "setenv http_proxy http://proxy.example.com:3128/" > /etc/profile.d/http_proxy.csh

The extension of these files determines which shell will read them. The commands are not interchangeable.

Other programs

yum

To configure yum to use a proxy, modify the /etc/yum.conf file with the following :

proxy=http://proxy.example.com:3128 
proxy_username=yum-user 
proxy_password=qwerty

subscription-manager

To configure subscription-manager to use a proxy, modify the /etc/rhsm/rhsm.conf file with the following:

proxy_hostname=proxy.example.com
proxy_port=3128
proxy_username=yum-user 
proxy_password=qwerty

RHN programs (e.g. rhn-register, up2date):

Modify the /etc/sysconfig/rhn/up2date file with the following:

httpProxy=proxy.example.com:3128

If authentication is required, use:

httpProxy=proxy.example.com:3128
proxyUser=yum-user
proxyPassword=qwerty
enableProxy=1

Leave a Reply

Your email address will not be published. Required fields are marked *

Categories

Get Free Shipping on Everything All Season Long
Best Buy Co, Inc.
Best Buy Co, Inc.