Linux software is organized in packages, and
apt is the software that manages those packages. A software package may depend on many other software packages in order to run. For example, if you install the package for Wine,
apt will report that
wine depends on several other packages, which in turn depend on other packages that do certain things for Wine, like fonts, filesystem utilities, filetype support, etc.
Organizing software this way has many advantages.
- There is no need to install a piece of software twice.
- It is incredibly easy to remove and install packages because it is all automated.
- Removing software is always non-invasive.
- Upgrading software is a breeze.
- There is no need to keep track of a bunch of downloaded executable installer files.
In Windows, you would have one big folder for a program holding all the software binaries, icons, configuration files, and the whole blob for a specific program. In Linux, you have a dedicated folder for all the icons the system uses (
/usr/share/icons), all the binaries (
/bin), all the firmware files (
/lib/firmware), and the rest. The package file for a piece of software keeps track of all of its files across the system. Things are a lot easier to find this way.
When you install a package, this is what happens: Say you invoke the command
sudo apt-get install libreoffice:
- The package lists on your computer (in
/var/lib/apt/lists) are checked for a package named
libreoffice. The lists provide information about all of the different installable packages, which are stored on http://archive.ubuntu.com/. The website is not meant to be browsed by users (see below), instead it's intended to be used by apt. The package's dependencies are examined (in
libreoffice's case the list is extensive). If dependencies need to be installed, they are added to the list of packages to be installed, in the correct order.
- The packages are all downloaded from http://archive.ubuntu.com/. If you have selected a different mirror to get more speed, they are downloaded from there.
- The package files themselves are ar achives which in turn contain archives for program data, and information on where the data goes with more detailed information about the package. The packages are decompressed individually and then set up according to what is detailed in the package's control information in the archive. Any specific scripts are then run and configuration files are changed.
- Meanwhile, apt keeps track of the status of the packages: whether they are installed, partially installed, or not installed.
If you want to know what is going on "behind the scenes", you can check the files that a package installs across the system on http://packages.ubuntu.com/. You can also download .deb package files from there, if you need to, but you wouldn't typically want to. You can also use
apt to download and see the details of packages.
- To download a package file and its dependencies:
sudo apt-get download
- To see the details of a package:
sudo apt-cache showpkg <package>
- To see what packages you have downloaded (this directory is normally
write-protected and not accessible by normal users):
- To clear the cache and save disk space:
sudo apt-get clean
To conclude, in Linux, it is not necessary to know as the user where all the package's files are kept and what exactly is being done when you install one, unless you are doing advanced operations that explicitly require that knowledge. You have the powerful Software Center to see what programs you have installed and you can use that to install and remove them.