Ubuntu – How to use a local package mirror at system installation time

aptpackage-managementsystem-installationupdatesupgrade

I would like to use a local mirror of the Ubuntu repositories when I'm completing an Ubuntu Server installation. I have a mirror already created to serve the repository over the LAN using http, this works for updates/upgrades with machines using custom a /etc/apt/sources.list file.

How do I ensure that any package updates/upgrades which are used in a normal Ubuntu installation come from this source? I could complete the installation with the network cable unplugged, replace the sources file, and then upgrade the packages, but would rather do it all as part of the initial installation phase.

Ideally the answer will not involve building my own custom version of the installer, but if that's a necessary process feel free to describe it. As this is a server version installation, it's not possible to simply change the sources file in a live session.

Best Answer

Maybe you should just install a (transparent) http proxy. I would suggest that you install a solution based on apt-cacher/apt-cacher-ng.

This way you only have to set the http_proxy environment variable while installing.

Related Question