Installing ElasticSearch on Ubuntu behind an apt-cacher proxy

My setup requires an apt-cacher as a proxy between the box on which I have ELK installed and the internet. I ran into a problem installing Elasticsearch from the public apt repository. The problem was:

E: Failed to fetch http://packages.elastic.co/elasticsearch/1.5/debian/pool/main/e/elasticsearch/elasticsearch-1.5.2.deb 403 Sorry, not allowed to fetch that type of file: elasticsearch-1.5.2.deb

Googling this problem did not result in anything meaningful, but I did find a solution. The solution I found was to change the apt-cacher configuration - it has a filter on package names in a perl regular expression, I relaxed its default a little bit to allow the elasticsearch-1.5.2.deb package to go through.

The configuration is in /etc/apt-cacher/apt-cacher.conf, to fix it you need to add the following:

package_files_regexp = (?:[1]+[]*(?:\d:)?[-+.~a-zA-Z0-9]+(?:[][-a-z0-9].(?:u|d)?deb|.dsc|.tar(?:.gz|.bz2|.xz)|.diff.gz)|.rpm|index.db-.+.gz|.jigdo|.template)$

I thought I'd share this - it might help someone.

Amir


  1. -+.a-z0-9 ↩︎