How to specify that Yum should not use proxy for specific domain

Solution 1:

I have not been able to get this to work using environment variables as you describe here. Yum does support proxies itself, however, and you should be able to do something like this:

proxy=http://proxy:port

Into yum.conf and then adding

proxy=_none_

Into the repo definitions you don't want to access via the global proxy. This is detailed (albeit succinctly) in the yum.conf man page.

Solution 2:

If I understand this question correctly the desired behaviour is

packages.centos.com gets pulled via a proxy.

packages.internal.lan goes direct without going via the proxy.

I've just arrived here having googled how to do this myself, and used the above info to achieve what I wanted, however I'm not sure if the above answer is complete.

To do this I used the following.

export HTTP_PROXY=http://myproxy.internal.lan:port

export no_proxy=internal.lan

yum install package1 package2

package1 got pulled from the internet via the proxy,

package2 got pulled from my local mirror not going through the proxy.