To use a specific example, I want to download the binary release of Hadoop 2.7.2. The web site points to http://www.apache.org/dyn/closer.cgi/hadoop/common/hadoop-2.7.2/hadoop-2.7.2.tar.gz which then points to the closest mirror by location. For me that is http://xenia.sote.hu/ftp/mirrors/www.apache.org/hadoop/core/hadoop-2.7.2/hadoop-2.7.2.tar.gz.
I want to actually download this in a shell script (a Dockerfile to be specific). I would prefer to use a location-agnostic URL for the download so that if someone runs the script on the other end of the world, they would not use the same mirror.
Is there a URL I could use with wget
or curl
that dynamically redirects to the closest mirror? What would that URL be for this specific file?
The source code of closer.lua actually states that the
action
andfilename
query parameters may be used to produce a redirect to the requested file on the automatically chosen mirror instead of the usual HTML mirror selection page.So you can download the files directly via this URL: https://www.apache.org/dyn/mirrors/mirrors.cgi?action=download&filename=hadoop/common/hadoop-2.7.2/hadoop-2.7.2.tar.gz: