我想查看将下载的软件包的所有 URL,apt install <pkg>
而无需实际安装该软件包。
通常,安装包后可以从屏幕输出中提取 URL(如上所述)。
我想要列出的 URL 示例: http://cdn-fastly.deb.debian.org/debian/pool/main/n/nmap/nmap-common_7.70+dfsg1-6_all.deb
是否只能通过查看所有的apt
包源列表才能事先获得这样的 URL 列表?
答案1
apt install
有一个--print-uris
选项可以做到这一点:
$ apt install --print-uris libreswan
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following additional packages will be installed:
libcurl3-nss
The following NEW packages will be installed:
libcurl3-nss libreswan
0 upgraded, 2 newly installed, 0 to remove and 7 not upgraded.
Need to get 1,255 kB of archives.
After this operation, 4,584 kB of additional disk space will be used.
'http://ftp.fr.debian.org/debian/pool/main/c/curl/libcurl3-nss_7.64.0-4_amd64.deb' libcurl3-nss_7.64.0-4_amd64.deb 335908 MD5Sum:376a45e2415e9aea88f5c8825dba0697
'http://ftp.fr.debian.org/debian/pool/main/libr/libreswan/libreswan_3.27-6_amd64.deb' libreswan_3.27-6_amd64.deb 919276 MD5Sum:cc05b89c596bcf40ac16a9e9fd4185b9
它列出了所有要下载的包,及其 URI、目标文件名、文件大小和哈希值。
请注意,本地 APT 缓存中已存在的文件不会列出。