2

My company uses lots of Ubuntu workstations so I have built an internal Ubuntu mirror, which works very well - it syncs once a day, and then everything on the LAN gets updates at gigabit speed. However, it's only really practical for computers that don't leave the office, e.g. desktops. We have a number of laptops that I have had to set up with public repos since the local mirror isn't available outside the LAN.

I've read How do you select the fastest mirror from the command line? and it's good insofar as APT has the option to autoselect package sources, but this only covers official mirrors. Is it possible to get APT to automatically use the local mirror if it's available (e.g. DNS resolves correctly, ping, whatever) and fall back to a public mirror when laptops are taken outside the office? I've already discovered that APT does not like duplicate sources so specifying the deb lines twice won't work. I'm sure I could write some scripts to do it but it would be quite hacky so I'm keen to see if there's a more elegant solution.

  • Does your company have an external-facing site? If so, you can use a mirrors.txt file like http://mirrors.ubuntu.com/mirrors.txt, which lists internal servers when viewed from intranet, and redirects to http://mirrors.ubuntu.com/mirrors.txt when viewed from outside. – muru Dec 27 '17 at 11:31
  • @muru we do, yes, and the thought has occurred to me. I'll keep that as a reserve idea (since I don't have any control of the external site and would have to present a business case for changes). – Gargravarr Dec 27 '17 at 13:03

0 Answers0