Apt-get下载deb流程简记

来自三线的随记

简记

架构值取自

dpkg --print-architecture

可以通过 --add-architecture 修改

假设有一个sources.list 定义如下

# Tailscale packages for ubuntu xenial
deb https://pkgs.tailscale.com/stable/ubuntu xenial main

那么他的Packages地址就是

https://pkgs.tailscale.com/stable/ubuntu/dists/xenial/main/binary-${架构}/Packages


例如:

https://pkgs.tailscale.com/stable/ubuntu/dists/xenial/main/binary-i386/Packages
https://pkgs.tailscale.com/stable/ubuntu/dists/xenial/main/binary-i386/Packages.gz

然后Packages文件里面会描述相关的版本,依赖,下载地址,校验码等信息,例如:

Package: tailscale
Version: 1.42.0
Section: net
Priority: extra
Architecture: amd64
Maintainer: Tailscale Inc <[email protected]>
Installed-Size: 42894
Replaces: tailscale-relay
Depends: iptables, iproute2
Recommends: tailscale-archive-keyring (>= 1.35.181)
Conflicts: tailscale-relay
Homepage: https://www.tailscale.com
Description: The easiest, most secure, cross platform way to use WireGuard + oauth2 + 2FA/SSO
Filename: pool/tailscale_1.42.0_amd64.deb
Size: 23655910
MD5sum: b457a8d0fe4037af52e0dc31b948ea66
SHA1: b5472e16934e70b9c1922ae92d050f09458dd20b
SHA256: 2492c2dd9e2aa55ef9524c6e49449a6c327a54bbe36b06127a7309f048d9b271

然后apt-get就会根据以上定义到如下地址去找deb文件

https://pkgs.tailscale.com/stable/ubuntu/pool/tailscale_1.42.0_i386.deb


Related article: https://unix.stackexchange.com/questions/521328/how-does-apt-get-work-in-detail