15 August 2014

Overview

If you have bunch of servers it’s always good idea to have local mirror or at least caching the requests to the remote repositories. I was using apt-cacher since we had only Debian based linux servers. Few months ago we started to use also CentOS for some critical services to avoid single points of failure.

There is no such software as apt-cacher for RPM based distros, but apt-cacher-ng is able to deal with this.

Apt-Cacher-Ng

Installing

Install apt-cahcer-ng is as simple as typing apt-get install apt-cacher-ng.

Configuration

/etc/apt-cacher-ng/acng.conf is mostly self-document. The Configuration item I’m going to write is Remap-....

Provided list of the mirrors in the package is a little bit out of date. I wrote few scripts to refresh these lists.

The scripts could be found in my Github page. Feel free to used/update them.

Remap for Debian

Debian do not provide any usable list of the mirror list. The full list of the mirrors is on the page Debian Mirror List. I was insired by the netselect-apt which could be found in Debian Repository.

Remap-debian: file:/etc/apt-cacher-ng/mirror_list.d/list.debian
Remap-debian-security: security.debian.org
Remap-debian-security: file:/etc/apt-cacher-ng/mirror_list.d/list.debian-security
Remap-debian-backports: file:/etc/apt-cacher-ng/mirror_list.d/list.debian-backports
Remap-debian-volatile: file:/etc/apt-cacher-ng/mirror_list.d/list.debian-volatile
Remap-debian-archive: file:/etc/apt-cacher-ng/mirror_list.d/list.debian-archive

Remap for Ubuntu

For Ubuntu I have found nice page http://mirrors.ubuntu.com/.

Archive Mirrors are listed on the https://launchpad.net/ubuntu/+archivemirrors. A this oment I realy do not want to parse this page to get out the list, so I will mark this task as TODO.

For security mirrors I haven’t found any mirror list, that means still in TODO.

Remap-ubuntu: file:/etc/apt-cacher-ng/mirror_list.d/list.ubuntu
Remap-ubuntu-security: security.ubuntu.com
Remap-ubuntu-archive: archive.canonical.com

Remap for CentOS

CentOS Mirror List is nice web page, When you look to the sources, you will see link to full-mirrorlist.csv.

Remap-centos: file:/etc/apt-cacher-ng/mirror_list.d/list.centos

Remap for Fedora EPEL

Fedora EPEL Mirror List is not very suitable to parse. So I used the URL which is connected by yum. http://mirrors.fedoraproject.org/metalink?repo=epel-6&arch=x86_64. The script will try predefined EPEL REPO and EPEL ARCH in full matrix and do the join of the mirror sites.

Remap-fedora-epel: file:/etc/apt-cacher-ng/mirror_list.d/list.fedora-epel

Remap for Fedora

Fedora Mirror List is the same page as for the EPEL REPO. But the returned XML is very short and only the nearest geolocated mirrors are included. So this is still TODO.

Notes

HTTPS connect

The default apt-cacher-ng configuration do not allow CONNECT. You need to change the configuration to allow HTTPS or use only HTTP mirrors. This applies maily to the yum repos mirrorlist configuration item.