在特殊代理后面添加 apt-repository,其中 URL 需要以代理的 IP 作为前缀

在特殊代理后面添加 apt-repository,其中 URL 需要以代理的 IP 作为前缀

在工作中,我们的 Linux 服务器位于代理后面,因此 URL 需要看起来像这样才能从我们的服务器访问,例如:

PROXY_IP=x.y.z.t
example URL : http://$PROXY_IP/archive.ubuntu.com/ubuntu

尝试添加 Launchpad PPAppa:rmescandon/yq,所以我首先尝试:

$ export http_proxy=http://x.y.z.t
$ sudo -E add-apt-repository ppa:rmescandon/yq

该命令挂起,因此我按下了 CTRL+C。

然后我尝试了别的方法:

$ sudo add-apt-repository deb http://x.y.z.t/ppa.launchpadcontent.net/rmescandon/yq/ubuntu $(lsb_release -sc) main
Repository: 'deb http://x.y.z.t/ppa.launchpadcontent.net/rmescandon/yq/ubuntu jammy main'
Description:
Archive for codename: jammy components: main
More info: http://x.y.z.t/ppa.launchpadcontent.net/rmescandon/yq/ubuntu
Adding repository.
Press [ENTER] to continue or Ctrl-c to cancel.
Found existing deb entry in /etc/apt/sources.list.d/archive_uri-http_x_y_z_t_ppa_launchpadcontent_net_rmescandon_yq_ubuntu-jammy.list
Adding deb entry to /etc/apt/sources.list.d/archive_uri-http_x_y_z_t_ppa_launchpadcontent_net_rmescandon_yq_ubuntu-jammy.list
Found existing deb-src entry in /etc/apt/sources.list.d/archive_uri-http_x_y_z_t_ppa_launchpadcontent_net_rmescandon_yq_ubuntu-jammy.list
Adding disabled deb-src entry to /etc/apt/sources.list.d/archive_uri-http_x_y_z_t_ppa_launchpadcontent_net_rmescandon_yq_ubuntu-jammy.list
Hit:1 http://x.y.z.t/archive.ubuntu.com/ubuntu jammy InRelease
Hit:2 http://x.y.z.t/archive.ubuntu.com/ubuntu jammy-updates InRelease
Get:3 http://x.y.z.t/archive.ubuntu.com/ubuntu jammy-backports InRelease [99.8 kB]
Get:4 http://x.y.z.t/archive.ubuntu.com/ubuntu jammy-security InRelease [110 kB]
Hit:5 http://x.y.z.t/apt.postgresql.org/pub/repos/apt jammy-pgdg InRelease
Get:6 http://x.y.z.t/ppa.launchpadcontent.net/rmescandon/yq/ubuntu jammy InRelease [18.0 kB]
Err:6 http://x.y.z.t/ppa.launchpadcontent.net/rmescandon/yq/ubuntu jammy InRelease
  The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 6657DBE0CC86BB64
Reading package lists... Done
W: GPG error: http://x.y.z.t/ppa.launchpadcontent.net/rmescandon/yq/ubuntu jammy InRelease: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 6657DBE0CC86BB64
E: The repository 'http://x.y.z.t/ppa.launchpadcontent.net/rmescandon/yq/ubuntu jammy InRelease' is not signed.
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.

最后,我/etc/apt/sources.list.d/yq.list自己创建了一个文件,通过替换行中的https://by 。http://x.y.z.t/deb https://

但是,sudo apt update失败并显示以下错误消息:

W: GPG error: http://x.y.z.t/ppa.launchpadcontent.net/rmescandon/yq/ubuntu jammy InRelease: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 6657DBE0CC86BB64
E: The repository 'http://x.y.z.t/ppa.launchpadcontent.net/rmescandon/yq/ubuntu jammy InRelease' is not signed.
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.

EDIT0:检查此 PPA 是否可以从代理后面访问:

$ curl http://x.y.z.t/ppa.launchpadcontent.net/rmescandon/yq/ubuntu/dists/$(lsb_release -sc)/Release.gpg
-----BEGIN PGP SIGNATURE-----

iQIzBAABCgAdFiEEmi1h9rsDztdSK459Zlfb4MyGu2QFAmIfj5YACgkQZlfb4MyG
u2RJKQ//S1v/kUTJyhZ7tlVAi9/CQBIpLwSamV5xomRZhcdAWBOzmrEOPjUHOYnE
2yaNmujtUGW/IOMWW5HeHoxhe8gGVwrOSoz6rF3oFnqy83ymrcOXBZ2DblhPnEcJ
OXpYIY7srLgQ98A9SL8b/LlvA5NP96KvXkbGLxfHaSn6bLWEyIxkUnBDXqgMUpJw
1oAgER5XQPD4VWLz7BlAL02328al32jI9DCx/9JK2WbtB36q+Z/BoX1ghX1rB9zM
unkdgRa5NjwIPMkOVvBdPpFA3TX0rBX4ofT1Q69BNLVTqfUm9WWUV6HYPAqr8KZ3
0x1t2NzVGNNrEYFb16XPL2ujjHrcbScuEkn/ACY6wedHuZUsGF2drajkvAt+lJrz
Oso7KsO32GKvjLdEWT1w4yqd/K0X2IjQ1sx7JmTD8dVoFUwl5E+/UnM2dGTQJtSo
TBZ0SjY8ldKje7jSrRxd9OjUKVO1XzbU/uciavyHLH8bU3rsnZHFCrKmXN5wPjiM
RntcnEU+lcKs1e7EplpnyKY14Ds9XWRk2ghOCJzlJZSAdWP8fGmSbAZchzV+BPRE
Z7jrz05HxUW9ZkDKYqqQDV+vfMfooqUYoEcsLT/UbnbkGSVCzmRJ8x64OSkhlka0
Novfdr7sxD+WOEyqGdy+R6NycUMqRwxJK5EsCdpC1ZwT7tHm8mY=
=q6JV
-----END PGP SIGNATURE-----

EDIT0:经过一番调查,我发现使用的代理是apt-cacher-ng

我可能需要添加其他 PPA,如何轻松做到这一点?

相关内容