%20%E4%BB%8E%E4%BB%80%E4%B9%88%E5%AE%89%E8%A3%85%EF%BC%9F%20.png)
我最近sudo apt install
在 Linux 虚拟机上使用了一些有趣的命令,例如owsay 和 Telnet Star Wars,我想知道该命令实际上是从什么安装的?它从什么中获取代码?
答案1
软件包从存储库(“repos”)下载并安装。存储库在 /etc/apt/ 中配置,但可以使用以下命令列出apt-cache policy
:
$ apt-cache policy
Package files:
100 /var/lib/dpkg/status
release a=now
500 http://security.ubuntu.com/ubuntu focal-security/multiverse i386 Packages
release v=20.04,o=Ubuntu,a=focal-security,n=focal,l=Ubuntu,c=multiverse,b=i386
origin security.ubuntu.com
500 http://security.ubuntu.com/ubuntu focal-security/multiverse amd64 Packages
release v=20.04,o=Ubuntu,a=focal-security,n=focal,l=Ubuntu,c=multiverse,b=amd64
origin security.ubuntu.com
...
每个包都可以像这样详细检查apt show
:
$ apt show cowsay
Package: cowsay
Version: 3.03+dfsg2-7
...
Homepage: https://web.archive.org/web/20120527202447/http://www.nog.net/~tony/warez/cowsay.shtml
Download-Size: 18.5 kB
APT-Sources: http://mirrors.linode.com/ubuntu focal/universe amd64 Packages
Description: configurable talking cow
正如您所看到的,APT-Sources 行将告诉您该包来自哪个存储库,Homepage 行将告诉您代码最初来自哪里。