How to Configure Yum with Proxy

Nov 19, 2015 Linux

If the server is placed in network behind firewall and outgoing traffic is blocked by firewall, the only chance to install new packages from remote repo is through proxy (if that exists).

To configure yum package manager to use proxy server, we need to edit /etc/yum.conf:

[root@tuxfixer ~]# vim /etc/yum.conf

Add following lines to the file:

# Proxy URL or IP - proxy server:port number
proxy=http://proxy.example.com:8080
# Proxy credentials (if required by proxy)
proxy_username=user
proxy_password=password

Examples:

1) Enable yum to use proxy 56.254.212.119 on port 8080. Proxy doesn’t require credentials:

proxy=http://56.254.212.119:8080

2) Enable yum to use proxy 52.254.211.118 on port 1040 with the username proxyuser and password proxypassword:

proxy=http://52.254.211.118:1040
proxy_username=proxyuser
proxy_password=proxypassword

3) Exclude particular repo from using proxy, in case global YUM proxy already set in yum.conf (overrides yum.conf proxy settings). In your .repo file add the following line:

proxy=_none_

Leave a Reply

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

This site uses Akismet to reduce spam. Learn how your comment data is processed.