I recently used sudo apt install
on my Linux Virtual Machine to get funny commands like cowsay and Telnet Star Wars and, I was wondering, what does the command actually install from? What does it take the code from?
1 Answer
Packages are downloaded from the repositories ("repos") and installed. The repos are configured in /etc/apt/ but can be listed with 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
...
Each package can be examined in detail with apt show
like this:
$ 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
As you can see, the APT-Sources line will tell you which repository the package came from, and the Homepage line tells you where the code originally came from.
man 5 sources.list