Debian-Pkg - A 5 minute howto on using the Debian package management system * Introduction This document is written by Joost van Baal for Sundaram Chatty and his colleagues at TUT in Pretoria-North, South Africa. * After installing a Debian system. If you want to use the installation and configuration menu after installation, run # base-config . * Configuring the package management system Make sure you have a sane /etc/apt/sources.list file. The Debian installation creates one for you. The one on host econel looks something like: deb http://debian.lcs.mit.edu/debian/ sarge main deb http://security.debian.org/ stable/updates main # Joost van Baal's stuff (caspar, uruk a.o.) # See http://mdcc.cx/software for information deb http://mdcc.cx/debian local contrib . * Keeping your system up to date If you're running a stable Debian version, you'd like security updates. If you're running a not-yet stable Debian version, you'd like both security updates and not-security-related bugfixes and feature improvements of your packages. In both setups, type aptitude update && aptitude dist-upgrade && aptitude clean regularly (e.g. once a week), to keep your system up to date. It's very wise to subscribe to debian-security-announce@lists.debian.org, in order to get a mail messages once security alerts (DSA's, Debian Security Announcements) are published. See http://www.debian.org/security/ . ** Installing extra packages Type dselect update && apt-get install && apt-get clean Do NOT install software from other vendors than Debian (unless you REALLY REALLY REALLY know what you're doing). Since the Debian archive is quite huge, very likely the stuff you need has been packaged by Debian. If you install stuff from e.g. tarballs, you miss all the benefits of the package management system: very easy upgrades, no conflicts, very easy removal of packages. ** Removing packages Type dpkg --purge . * Information on packages List all files belonging to one (installed) package dpkg --list Given a file, find which package it belongs to dpkg -S (Or use dlocate, that's faster.) Use apt-file to find out about files in packages which are not installed. Short note on what a package is about apt-cache show Finding a packagename apt-cache search (e.g.: apt-cache search imap ssl perl .) Finding out which version of package is installed, and status of install (purge, on hold, error) dpkg --list Listing all installed packages dpkg --list Other information on the package, like ChangeLog (changes in the software itself), changelog.Debian.gz (changes in the Debian packaging of the software), copyright (license, author, package's website) etc, is stored in /usr/share/doc// . * Undocumented features, dpkg internal files For each installed package, /usr/share/doc// and files /var/lib/dpkg/info/.* are created. So, ls /var/lib/dpkg/info/*.list gives names of all installed packages. /var/lib/dpkg/status gives information on status of each package. Downloaded packages are kept in /var/cache/apt/ (and removed after installation if asked). To find out at what time package was installed, do ls -l /var/lib/dpkg/info/.list . * Reconfiguring after the fact dpkg-reconfigure This will show you _all_ questions: it runs in expert-mode by default. If you want to see just the questions you're used to being asked (e.g. skip questions about low-level technical detail issues), run dpkg-reconfigure --default-priority . * Advanced stuff: building your own packages Notes on how to build packages in a chroot environment, by Goswin von Brederlow, are on http://lists.debian.org/debian-mentors/2004/04/msg00013.html . This is useful if you want to build a package for a different Debian release as the one you're currently running, or when you want to be sure the build dependencies of the package are exactly as they should be. And it's a nice stress test for the package build system as well: it might catch other errors. * Advanced stuff: searching for csbs-using packages If you'd like to search for a package using some particula package build system, you can use something like (the example lists all Build-Depends (e.g. debhelper and cdbs) for all packages matching python*, it's a buggy example btw): joostvb@nagy:~% apt-cache showsrc $(apt-cache pkgnames python) | egrep '^Package|^Build-Depends' | less * Advanced stuff: disabling daemons To keep the (e.g.) mysql package installed, but to make sure the deamon won't run (and won't get started on package upgrades), do: update-rc.d -f mysql remove (This removes the /etc/rc?.d/ symlinks.) update-rc.d mysql stop 21 0 1 2 3 4 5 6 . (This creates K-symlinks in /etc/rc?.d/.) Now, running invoke-rc.d mysql start will exit successfully, but won't do anything. * If something goes wrong: the Debian Bug Tracking system BTS Bugs in Debian packages are to be reported by sending a report in an email to the Debian Bug Tracking system. You can use the reportbug(1) tool for this. Bugreports are archived at http://bugs.debian.org/ . You can look for known bugs in packages by pointing your webbrowser to http://bugs.debian.org/ . Another way to query the BTS database is doing reportbug --query-only . If you're interested in the status of a particular bug, use an URL like http://bugs.debian.org/ . * Alternatives You could use dselect instead of apt-get. You could use aptitude instead of apt-get. * See also The "Debian GNU/Linux FAQ" in Debian package doc-debian; online at http://www.debian.org/doc/manuals/debian-faq/index.en.html . The "dselect Documentation for Beginners" document might be interesting. (Beware! It is currently unmaintained, but still quite useful.) Get it from http://www.debian.org/doc/manuals/dselect-beginner/index.en.html . The "APT and Dpkg Quick Reference Sheet" by Matthew Danish (in Debian package apt-dpkg-ref) has about the same content as this document. * Version, availability This is version $Id: debian-pkg.txt 13193 2007-05-21 10:56:50Z joostvb $ of $URL: https://infix.uvt.nl/its-id/trunk/sources/uvt-unix-doc/debian-pkg.txt $. This document is published on http://www.non-gnu.uvt.nl/pub/uvt-unix-doc/ . * Copyright Copyright (C) 2004 Joost van Baal, Copyright (C) 2004 Tilburg University http://www.uvt.nl/ . This document is free; you can redistribute it and/or modify it under the terms of the GNU GPL, see http://www.gnu.org/copyleft/gpl.html . There is NO WARRANTY.