让 apt 使用本地缓存 - apt-cacher-ng

让 apt 使用本地缓存 - apt-cacher-ng

我有一台主机,我已安装apt-cacher-ng并复制了预填充缓存在 下/var/cache/apt-cacher-ng。我看到服务正在运行,没有错误。但是,当我尝试下载某些内容时,apt似乎仍然尝试使用archive.ubuntu.com!此主机没有网络连接。我如何确保apt仅使用本地缓存?

我还添加了以下配置:

$ cat /etc/apt/apt.conf.d/99_local_proxy.conf
Acquire::http::Proxy "http://localhost:3142/";
Acquire::ForceIPv4 "true";
Acquire::Retries "3";

这是我收到的错误:

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]

答案1

抱歉,我误会了。

您需要的是一个不与互联网通信的个人存储库。更棒的是,它已经完成了,记录在案,并且已发布在 Ubuntu wiki 上。

Ubuntu Wiki - 个人仓库

个人存储库的部分说明是将 sources.list 更改为文件路径。如果没有网络 URL(http/https/ftp),则 apt 将不会访问网络。它只会查找 sources.list 文件中列出的位置。

相关内容