ChrootでWebプロキシにアクセスするには?

ChrootでWebプロキシにアクセスするには?

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

chrootでこれを行うと、apt-get update次のようになります。

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インストールパッケージを作成するには?

ベストアンサー1

おすすめ記事