I have a host where I have installed apt-cacher-ng
and copied over a pre-populated cache under /var/cache/apt-cacher-ng
. I see that the service is running with no errors.
However, when I try to download something, apt
still seems to try and use archive.ubuntu.com
!
This host does not have network connectivity. How can I make sure to tell apt
to use only the local cache ?
I have also added the following config:
$ cat /etc/apt/apt.conf.d/99_local_proxy.conf
Acquire::http::Proxy "http://localhost:3142/";
Acquire::ForceIPv4 "true";
Acquire::Retries "3";
This is the error I get:
W: Failed to fetch http://us.archive.ubuntu.com/ubuntu/dists/bionic/InRelease 503 DNS error for hostname us.archive.ubuntu.com: Temporary failure in name resolution. If us.archive.ubuntu.com refers to a configured cache repository, please check the corresponding configuration file. [IP: 127.0.0.1 3142]
Sorry, I misunderstood.
What you want is a personal repository with no traffic to the internet. Even better, it's already been done, documented, and it's up on the Ubuntu wiki.
Ubuntu Wiki - Personal Repository
Part of the directions for a personal repository is changing the sources.list to a file path. If there are no network URLs (http/https/ftp) then apt will not go on the network. It will only look in the locations listed in the sources.list file.