It seems apt-get install will download a Debian package and try to run installation script for:

  • Create proper directory
  • Create proper account
  • Copy Binary files
  • Copy Data files
  • Copy Conf files
  • Copy init.d script
  • Start service
  • etc.

I’m really interested in it and want to figure out what’s going on step-by-step. Is there any way to it see? Like print shell commands in a “dry run” mode?


In short: apt-get install does everything that is needed that your system can successfully execute the new installed software application.

Longer version:


From the manpage:

All packages required by the package(s) specified for installation will also be retrieved and installed.

Those packages are stored on a repository in the network (internet). So, apt-get downloads all the needed packages into a temporary directory (/var/cache/apt/archives/). They will be downloaded from a web- or a ftp-server. They are specified in the so called sources.list; a list of repositories for the package manager apt. From then on, they get installed one by one procedurally.

The first ones to be installed are the ones, that have no further dependencies; so no other package has to be installed for them to work properly. Trough that, other packages (that had dependencies previously) haven't now dependencies anymore. The system keeps doing that process over and over until the specified packages are installed.

Each package undergoes an installation procedure.

Package installation procedure:

In Debian-based Linux distributions, as Ubuntu or Mint, those packages are in a specified standardized format called: deb --> The Debian binary package format.

Such a package contains the files to be installed on the system. Also they contain a control file. That file contains scripts that the packaging system should execute in a specific situation; the so called maintainer scripts. Those scripts are splitted in:

  • preinst: before the installation of the files into the systems file hierarchy
  • postinst: after the installation
  • prerm: before the uninstallation
  • postrm: after the uninstallation

Those scripts are the place where specific users are created or some services that need to be restarted or other preliminaries that are needed for the package to work.

Besides those scripts the package system has triggers that are intended for specific events. For example the regeneration of initrds when installing a new kernel version or ldconfig or the man-db. They are activated by one or more packages and run in the end of the whole installation process.

There is an interessting picture, showing the procedure of an installation of a new package:


There are also more control-files, the most important are as follows:

If you are interessted you can unpack a deb package (after downloading) manually and watch whats inside:

# to only download the package (no installation)
apt-get download package
# to unpack the deb file
ar x package.deb

Now you see a file called data.tar.gz containing the files and a file called control.tar.gz containing the four maintainer scripts and the above mentioned control-files.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.