DEV Community

Katakuri2015
Katakuri2015

Posted on • Edited on

How does Linux automatically identify which application to install when using the "sudo apt-get install" thingy?

I completed a Linux course that required me to install many programmes, but I still don't understand how Linux can install programmes like VLC Media Player with simply the command "sudo apt-get install vlc."

as in wtf? How did it know that VLC Media Player, rather than a different software with "vlc" in the name, is the one I want to install? What if there are several versions available? How did it decide which one to use?

youtube thumbnail download

Top comments (2)

Collapse
 
phlash profile image
Phil Ashby

I guess your Linux course didn't cover package managers and repositories then 😁

Your distribution (in your case Debian or a derivative like Ubuntu or Mint) comes with a database of available software known as a repository, and a set of tools known as the package manager that can query this repository, using short but unique terms like vlc to get a list of packages / programs to install. This includes all the libraries and sometimes additional data which the program depends on to ensure it works. here's a great article on the details:

embeddedinventor.com/a-beginners-i...

Collapse
 
mvelazquez profile image
Manuel Velázquez

It didn't automatically decided it, package managers (APT being one of them) are strict about the name of the packages or programs, so for example vlc is different than vlc-extras.

When you tell the package manager to install vlc it knows exactly which package to install because there is only one that is named exactly vlc, if you wanted to install another package that also has vlc in the name you need to type the full name of that other package.

About the versions, package managers usually install the latest version available in their repository which is a collection of available packages. If you want a different version you need to explicitly tell it which version you want. Note that the latest version in a repository not necessarily means the latest version of that program, this is because usually packages need to be tested before being added to the repository, and sometimes this doesn't happen as fast as one would hope.