rickysarraf / apt-offline

Offline APT Package Manager
http://rickysarraf.github.io/apt-offline/
GNU General Public License v3.0
215 stars 37 forks source link

Wish: apt-offline handles mirror method #16

Closed R-Sommer closed 9 years ago

R-Sommer commented 9 years ago

apt-offline uses sources.list from the machine where apt-offline set is started. The URLs within apt.sig are then downloaded at the machine where apt-offline get is started. As an example: When the set is started at a machine in Brasil and get is started at a machine in Germany, then apt-offline downloads from mirrors in Brasil (which is of course not the best performance option).

One idea to optimize this behavior is using the mirror option of apt: apt (apt-get) can automatically select a "good" mirror based on the location. In /etc/apt/sources.list a line like

deb mirror://mirrors.ubuntu.com/mirrors.txt ...

instead of

deb http://es.archive.ubuntu.com/ubuntu/ ...

motivates apt to download es.txt from http://mirrors.ubuntu.com/, if it is started in a location in Spain. With this option I could use the same sources.list for all (offline) machines around the world and apt-offline automatically choose a "good" mirror for get based on the location where is is started.

rickysarraf commented 9 years ago

On 12/23/2014 05:58 PM, R-Sommer wrote:

apt-offline uses sources.list from the machine where apt-offline set is started. The URLs within apt.sig are then downloaded at the machine where apt-offline get is started. As an example: When the set is started at a machine in Brasil and get is started at a machine in Germany, then apt-offline downloads from mirrors in Brasil (which is of course not the best performance option).

But wouldn't that be a very unrealistic workflow. No one has a machine in Brasil in the morning, and then a machine in Germany, in the evening.

One idea to optimize this behavior is using the mirror option of apt: apt (apt-get) can automatically select a "good" mirror based on the location. In /etc/apt/sources.list a line like

deb mirror://mirrors.ubuntu.com/mirrors.txt ...

instead of

deb http://es.archive.ubuntu.com/ubuntu/ ...

motivates apt to download es.txt from http://mirrors.ubuntu.com/, if it is started in a location in Spain. With this option I could use the same sources.list for all (offline) machines around the world and apt-offline automatically choose a "good" mirror for get based on the location where is is started.

This is already solved by all distributions at the DNS level. For example, in Debian, ftp.debian.org would resolve to different IP addresses based on your current location.

Same goes for Ubuntu. A line like:

deb http://mirrors.ubuntu.com/ubuntu trusty main universe multiverse

The IP address in this case, that you get, will be different based on your current location.

Hence, I'm marking this bug as closed. This is a problem, already solved, at a different layer (DNS).

Ritesh Raj Sarraf RESEARCHUT - http://www.researchut.com "Necessity is the mother of invention."

R-Sommer commented 9 years ago

But wouldn't that be a very unrealistic workflow. No one has a machine in Brasil in the morning, and then a machine in Germany, in the evening.

Oh, I do. Because I'm connected to them remotely (some of them even at the same time sometimes).

Same goes for Ubuntu. A line like: deb http://mirrors.ubuntu.com/ubuntu trusty main universe multiverse The IP address in this case, that you get, will be different based on your current location.

Sure? Trying here in Germany result in:

The requested URL /ubuntu was not found on this server.

rickysarraf commented 9 years ago

On 12/24/2014 03:00 AM, Roland Sommer wrote:

But wouldn't that be a very unrealistic workflow. No one has a
machine in Brasil in the morning, and then a machine in Germany,
in the evening.

Oh, I do. Because I'm connected to them remotely.

If you machine has network, then you don't need apt-offline.

Ritesh Raj Sarraf RESEARCHUT - http://www.researchut.com "Necessity is the mother of invention."

R-Sommer commented 9 years ago

Hmm, you're thinking I spend hours and hours to document some bugs and do some tests for you although I don't need apt-offline? Some of our customers does not allow access to internet but remote access for support.

rickysarraf commented 9 years ago

On 12/25/2014 08:51 PM, Roland Sommer wrote:

Hmm, you're thinking I spend hours and hours to document some bugs and do some tests for you although I don't need apt-offline? Some of our customers does not allow access to internet but remote access for support.

I agree that there are genuine request. I've had people from defense organizations report about apt-offline. Same story there. They did not have access to outside world.

But all said, your feature request example, that of mirros.txt is not very clear to me. For example, where is that mirrors.txt ? What format is it in ? Does it follow any standards ? Nothing that I know of.

And I still think that you can solve that problem much easily at the DNS layer.

Assume, .sig has ftp.debian.org. At the workplace, you want the files to be accessible over ftp.ubuntu.com.

The easiest is to change the s/ftp.debian.org/ftp.ubuntu.com/g in your .sig file. Otherwise, you could also fetch the IP addr of ftp.debian.org and assign the same to ftp.ubuntu.com in /etc/hosts.

Does that make sense ?

Ritesh Raj Sarraf RESEARCHUT - http://www.researchut.com "Necessity is the mother of invention."

R-Sommer commented 9 years ago

The mirrors.txt must be replaced by apt with the country code i.e. DE and then http://mirrors.ubuntu.com/DE.txt is loaded. This text file contains a list of valid package mirrors i.e. DE.txt: http://mirror2.tuxinator.org/ubuntu/ http://ftp.tu-chemnitz.de/pub/linux/ubuntu-ports/ http://mirror.bauhuette.fh-aachen.de/ubuntu/ http://mirror.euserv.net/linux/ubuntu/ http://debian.charite.de/ubuntu/ http://ftp5.gwdg.de/pub/linux/debian/ubuntu/ http://de.archive.ubuntu.com/ubuntu/ http://ftp.hawo.stw.uni-erlangen.de/ubuntu/ http://ftp.uni-kassel.de/ubuntu/ubuntu/ http://ftp.hosteurope.de/mirror/archive.ubuntu.com/ http://mirror.netcologne.de/ubuntu/ http://ftp.tu-chemnitz.de/pub/linux/ubuntu/ http://ubuntu.mirror.tudos.de/ubuntu/ http://artfiles.org/ubuntu.com/ http://ftp.rrzn.uni-hannover.de/pub/mirror/linux/ubuntu/ http://vesta.informatik.rwth-aachen.de/ftp/pub/Linux/ubuntu/ubuntu/ http://ftp.halifax.rwth-aachen.de/ubuntu/ http://ubuntu.mirror.lrz.de/ubuntu/ http://mirror.serverloft.eu/ubuntu/ubuntu/ http://ftp.uni-bayreuth.de/linux/ubuntu/ubuntu/ http://ftp.tu-ilmenau.de/mirror/ubuntu/ http://ftp.stw-bonn.de/ubuntu/ http://ftp.rz.tu-bs.de/pub/mirror/ubuntu-packages/ http://mirror.skylink-datacenter.de/ubuntu/ http://ftp.fau.de/ubuntu/ http://ftp.uni-kl.de/pub/linux/ubuntu/ http://ftp.uni-stuttgart.de/ubuntu/ http://ubuntu.unitedcolo.de/ubuntu/ http://suse.uni-leipzig.de/pub/releases.ubuntu.com/ubuntu/ http://de2.archive.ubuntu.com/ubuntu/ http://ftp.uni-mainz.de/ubuntu/ http://mirror.23media.de/ubuntu/ http://ftp-stud.hs-esslingen.de/ubuntu/ http://mirror.de.leaseweb.net/ubuntu/ http://archive.ubuntu.com/ubuntu/

apt select one of it (based on rules I don't know) and use it as the download source. If apt-offline would do the same during the GET procedure, that would be very helpful. But you're right, it's not very important. Currently, I use the german mirrors on all sites, because it's currently only up to me to update the systems.

sed'ing would be another option. DNS I haven't checked, but I'd assume the invented mirrors.txt solution instead.