0

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?

3
  • 1
    from the repository that is configured on your local machine: see man 5 sources.list
    – brynk
    Feb 8, 2021 at 22:17
  • It should also be noted that your repositories likely have mirrors, so it's from a repository located on a specific mirror. Not all repositories have mirrors.
    – KGIII
    Feb 8, 2021 at 23:52
  • 3
    Does this answer your question? How does apt-get really work?, Also unix.stackexchange.com/questions/521328/…
    – muru
    Feb 9, 2021 at 2:36

1 Answer 1

2

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.

Not the answer you're looking for? Browse other questions tagged .