In short: apt-get install
does everything that is needed that your system can successfully execute the new installed software application.
Longer:
Preliminaries:
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. So, apt-get
downloads all the needed ones 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. From then on they get installed one by one procedurally.
The first ones are the ones, that have no further dependencies; so no other package has to be installed for them. Through that, other packages (that had dependencies previously) have now no 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:
In Debian-based Linux distributions, as Ubuntu, 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 split in:
preinst
: before the installation of the files into the systems filehierarchy
postinst
: after the installation
prerm
: before the uninstallation
postrm
: after the uninstallation
There is an interesting picture, showing the procedure of an installation of a new package:

There are also more control-files, the most important are as follows:
control
: A list of the dependencies, and other useful information to identify the package
conffiles
: A list of config files (usually those in /etc
)
debian-binary
: contains the deb-package version, currently 2.0
md5sums
: A list of md5sums of each file in the package for verifying
templates
: A file with error descriptions and dialogs during installation
apt-get
is being replaced byapt
. The replacement isn't complete yet, but it works forinstall
,upgrade
anddist-upgrade
among others.