Linux Labs

Packages, services, and logs / Stage 1 of 13

Packages, dependencies and repositories

Not running Starting usually ~20 s
Leave the lesson

Step 2 of 8 · on a machine · 4 min

Archive and installed package

The files in the directory are package archives. The program appears in the system once the package is installed.

On Ubuntu, programs are installed as packages. A package comes as an archive with the .deb extension: inside are the program's files and a description — the name, the version and the other packages the program cannot work without.

While the archive sits in a directory, it is an ordinary file. dpkg does the installation: it places the files from the archive across the system — the program into /usr/bin, settings into /etc — and makes a record in the package database. The record keeps the name, the version and the list of installed files.

dpkg -s reads that record. Compare the lesson's package with tree, a program installed along with the system:

bash
dpkg -s lab-pkg-report
dpkg -s tree

There is no record for lab-pkg-report: package 'lab-pkg-report' is not installed and no information is available. For tree the first lines are Package: tree and Status: install ok installed.

Check yourself 1 question

tree was installed from an archive in /var/cache/apt/archives, then that archive was deleted. What will dpkg -s tree print?

  • dpkg -s reads the record in the package database and never opens the archive. The record and the program files stay after the archive is deleted.

  • The archive is needed only during installation. dpkg -s takes its data from the package database.

Installation placed the tree files across the system and made a record in the package database. After that the archive is no longer needed: dpkg -s reads the record, and tree runs from /usr/bin/tree.

Key points

  • A package comes as a .deb archive holding the program's files and its description.
  • Installation places the files across the system and makes a record in the package database.
  • dpkg -s reads the database record: if it is there, the package is installed.
Ubuntu 24.04
Loading…