[CentOS] Use EPEL without redirection ?

Tue May 22 09:09:25 UTC 2018
Tony Mountifield <tony at softins.co.uk>

In article <3be1bec7-3d50-f8df-7012-982573d9ae80 at microlinux.fr>,
Nicolas Kovacs <info at microlinux.fr> wrote:
> Hi,
> Is there any way to deactivate the redirection to a mirror when using
> the third-party EPEL repository ?
> Our network uses a transparent HTTP/HTTPS proxy with a local AC. We can
> create exceptions for sites like centos.org or
> download.fedoraproject.org, but whenever we want to install a package
> from EPEL, the mirror redirection causes an error due to redirection.
> Any suggestions ?

Firstly in /etc/yum.repos.d/epel.repo you need to use baseurl instead
of mirrorlist. I assume you are already doing this.

So then you need to do a curl -i to the baseurl (change $basearch to either
i386 or x86_64) to see where it is redirecting you. For example:

$ curl -i http://download.fedoraproject.org/pub/epel/6/i386
HTTP/1.1 302 Found
Date: Tue, 22 May 2018 09:04:35 GMT
Server: Apache/2.4.29 (Fedora) mod_wsgi/4.5.15 Python/2.7
X-Frame-Options: SAMEORIGIN
X-Xss-Protection: 1; mode=block
X-Content-Type-Options: nosniff
Referrer-Policy: same-origin
Content-Length: 0
Location: https://www.mirrorservice.org/sites/dl.fedoraproject.org/pub/epel/6/i386/
Content-Type: text/html; charset=UTF-8
AppTime: D=4793
AppServer: proxy14.fedoraproject.org

Then edit baseurl in epel.repo to use the URL listed in Location: instead, changing
the i386 or x86_64 back to $basearch

Then you can create an exception for the specific host you configured.

Tony Mountifield
Work: tony at softins.co.uk - http://www.softins.co.uk
Play: tony at mountifield.org - http://tony.mountifield.org