apt-cacher-ng
我已经在我的笔记本电脑上设置了
cat /etc/apt/apt.conf.d/02proxy
Acquire::http { Proxy "http://localhost:3142"; };
我可以安装一个软件包,关闭互联网,删除该软件包然后再次安装。
find /var/cache/apt-cacher-ng -name "*komp*"
/var/cache/apt-cacher-ng/uburep/pool/universe/k/komparator
/var/cache/apt-cacher-ng/uburep/pool/universe/k/komparator/komparator_1.0-3_amd64.deb.head
/var/cache/apt-cacher-ng/uburep/pool/universe/k/komparator/komparator_1.0-3_amd64.deb
但是,在 chroot 中,当互联网关闭时,我无法安装相同的软件包。
我这样创建 chroot:
mkdir work
cd work
#This is a backup of a previous bootstrapped using --foreign
cp ../deboot.tgz .
sudo tar -xf deboot.tgz
sudo DEBOOTSTRAP_DIR=deboot/debootstrap/ debootstrap --second-stage --second-stage-target $(readlink -f deboot)
#Set locale settings in chroot
sudo chroot deboot locale-gen "en_US.UTF-8"
sudo chroot deboot dpkg-reconfigure --frontend=noninteractive locales
#Set apt cache proxy in chroot
echo 'Acquire::http { Proxy "http://127.0.0.1:3142"; };' | sudo tee deboot/etc/apt/apt.conf.d/00aptproxy
# mount the /proc filesystem in the chroot (required for managing processes)
sudo mount -o bind /proc deboot/proc
sudo chroot deboot
现在在 chroot 中我做:
cat etc/apt/apt.conf.d/00aptproxy
Acquire::http { Proxy "http://127.0.0.1:3142"; };
root@myhostname:/# apt-get install komparator
Reading package lists... Done
Building dependency tree... Done
E: Unable to locate package komparator
如果我apt-get update
在 chroot 中这样做,我会得到以下信息:
root@myhostname:/# apt-get update
Ign:1 http://archive.ubuntu.com/ubuntu zesty InRelease
Err:2 http://archive.ubuntu.com/ubuntu zesty Release
500 Connection failure: Network is unreachable
Reading package lists... Done
E: The repository 'http://archive.ubuntu.com/ubuntu zesty Release' does no longer have a Release file.
N: Updating from such a repository can't be done securely, and is therefore disabled by default.
N: See apt-secure(8) manpage for repository creation and user configuration details.
如何在主机上使用 apt-cacher-ng 制作 chroot 安装包?