Filed in: Documentation.Apt-getAndAptitude · Modified on : Mon, 06 Sep 10
On this page... (hide)
The GNU/Linux systems which use the Debian package management system (.deb packages - Debian software packages) usually make available several ways to manage packages. The base system mostly used is Advanced Packaging Tool (APT). It includes the ability to handle a GPG keyring, enabling a secure way to use repositories (Secure APT).
Also in gNewSense, package management is handled using the Debian package management system (gNewSense DeltaH packages are usually from Ubuntu most of which are ultimately from Debian, gNewSense MetaD packages come directly from Debian).
Packages are usually available online, at the appropriate repository. With a command-line interface or a terminal, the commands which are used to query the repositories and manage packages are apt-get and aptitude. In a graphical environment the application software mostly used is Synaptic, a graphical interface that provides almost all the features of aptitude.
Packages may also be available offline, in which case can be handled in a terminal by the dpkg command. A widespread used graphical interface for dpkg is the GDebi installer.
The list of the repositories used by the system is in the /etc/apt/sources.list file. The preferred way to change the repository info and manage their signature keys is through the Software Sources tool (menu: System > Administration > Software Sources).
Package maintainers create source and binary packages for many programs and platforms, from a variety of sources; this means most programs, over different platforms, can be installed or removed in a single step.
The two programs apt-get and aptitude have a very similar command-line functionality (aptitude also has a curses interface). However, aptitude has a better support for removing unneeded dependencies. Either program will install package B if package A requires it. However, aptitude will also remove package B if you remove package A (the version of apt-get in gNewSense DeltaD will not). In general, aptitude can accept all of apt-get's options, so, generally, it is simplest to use only one of them.
Please remember that the preferred way to change the repository info and manage the apt keys is through the Software Sources tool (menu: System > Administration > Software Sources).
In the continuation: <package> or <packageN> (N=1,2,...) means the package(s) name(s) <version> means the package version number <desc> means the package description
To install one or more packages and all their dependencies (to specify a package version add =<version> to the package name):
$ sudo apt-get install <package1> <package2> <...>
or
$ sudo aptitude install <package1> <package2> <...>
To remove one or more packages:
$ sudo apt-get remove <package1> <package2> <...>
or
$ sudo aptitude remove <package1> <package2> <...>
To remove one or more packages and all of their settings (eg. configuration files):
$ sudo apt-get --purge remove <package1> <package2> <...>
or
$ sudo aptitude purge <package1> <package2> <...>
Note that usually purging is not necessary, but it may be if a program installation fails or there are package conflicts.
To reinstall one or more packages:
$ sudo apt-get --reinstall install <package1> <package2> <...>
or
$ sudo aptitude reinstall <package1> <package2> <...>
To update the list of the available packages in the repositories:
$ sudo apt-get update
or
$ sudo aptitude update
To update all the installed packages to the last available version without installing or removing packages:
$ sudo apt-get upgrade
or
$ sudo aptitude upgrade
or
$ sudo aptitude safe-upgrade
To update all the installed packages to the last available version installing or removing other packages if needed (be aware: the upgrade option keeps also the old version packages when they need to satisfy other packages dependencies, but the dist-upgrade option do not! so the upgrade option is more conservative than the dist-upgrade option):
$ sudo apt-get dist-upgrade
or
$ sudo aptitude dist-upgrade
To remove all the downloaded and cached packages:
$ sudo aptitude clean
To remove just the unavailable packages from cache:
$ sudo aptitude autoclean
To download in the current directory the most recent available version of a .deb package:
$ sudo aptitude download <package>
To find the packages which name or description macthes a search string (regular expressions may be used):
$ apt-cache search <desc>
or
$ aptitude search <desc>
To show a package info:
$ apt-cache show <package>
or
$ aptitude show <package>
To show the dependencies of a package:
$ apt-cache depends <package>
or
$ aptitude show --show-deps <package>
To show detailed info about the available versions of a package and their dependencies:
$ apt-cache showpkg <package>
Please remember that the preferred way to change the repository info and manage the apt keys is through the Software Sources tool (menu: System > Administration > Software Sources).
In the continuation: <key-id> means the key ID <keyserver> means the URI of a keyserver <URI-of-keyfile> means the URI of a downloadable key file
To show the installed apt keys:
$ sudo apt-key list
To download the signature key file (it needs to known the URI of the key file) and after install it:
$ wget <URI-of-keyfile> $ sudo apt-key add <keyfile>
Example (gNewSense DeltaD repository key):
$ wget http://archive.gnewsense.org/gnewsense-deltad/dists/deltad/Release.gpg $ sudo apt-key add Release.gpg
To download and install the signature key from a keyserver (it needs to know the key ID):
$ sudo apt-key adv --keyserver <keyserver> --recv-keys <key-id>
Example (TOR project repository key):
$ sudo apt-key adv --keyserver keys.gnupg.net --recv-keys 886DDD89
gNewSense is a project developed by volunteers all over the world and it's supported by the Free Software Foundation.
The content in this Web site can be used as follows:
All documentation is available under the terms of the GFDL with no invariant sections. ( note on the license )
Artwork is Free Cultural Work and is available under the terms of the cc-by-sa license.