A small APT-Guide Cookbook
What does APT mean?
APT is short for Advanced Packaging Tool and is a collection of programs and scripts that help both the sysadmin (in your case root) with the installation and management of deb-files but equally the system itself to know what is installed.
Sources List
The "APT" -system needs a config-file that contains information about the locations of the installable and upgradeable packages and is commonly referred to as a sources.list.
Eros-pre2 installations forward
Eros-pre2 installations forward deals with /etc/apt/sources.list differently, namely it is empty. In its place is a directory or folder named:
/etc/apt/sources.list.d/
Inside the folder are 2 files called:
/etc/apt/sources.list.d/debian.list and
/etc/apt/sources.list.d/sidux.list
This has the benefit of easier (automated) mirror switching, and makes it safer to replace lists.
You can also add your own /etc/apt/sources.list.d/*.list files
Eros-pre1, Gaia Tartaros and Chaos installations
The sources list is found in/etc/apt/sources.list
All sidux ISOs use the following sources as default:
# Free University Berlin/ spline (Student Project LInux NEtwork), Germany deb ftp://ftp.spline.de/pub/sidux/debian/ sid main contrib non-free fix.main fix.contrib fix.non-free #deb-src ftp://ftp.spline.de/pub/sidux/debian/ sid main contrib non-free fix.main fix.contrib fix.non-free
Further entries for non-free needs can be found in our always updated sidux.list and debian.list. As at 28/02/2008 0800 hrs UTC they are:
# See sources.list(5) for more information, especially # Remember that you can only use http, ftp or file URIs # CDROMs are managed through the apt-cdrom tool. # The /etc/apt/sources.list.d/ directory provides a way to add sources.list # entries in separate files that end with sources.list file. # Unstable deb http://ftp.us.debian.org/debian/ unstable main contrib non-free #deb-src http://ftp.us.debian.org/debian/ unstable main contrib non-free # Testing #deb http://ftp.us.debian.org/debian/ testing main contrib non-free #deb-src http://ftp.us.debian.org/debian/ testing main contrib non-free # Experimental #deb http://ftp.us.debian.org/debian/ experimental main contrib non-free #deb-src http://ftp.us.debian.org/debian/ experimental main contrib non-free # Free University Berlin/ spline (Student Project LInux NEtwork), Germany deb ftp://ftp.spline.de/pub/sidux/debian/ sid main contrib non-free fix.main fix.contrib fix.non-free #deb-src ftp://ftp.spline.de/pub/sidux/debian/ sid main contrib non-free fix.main fix.contrib fix.non-free
NOTE: In this example ftp.us indicates its using USA repositories.You may edit this file, as root, to use the repositories closest to you, simply by changing the country, that is, change ftp.us to ftp.nl, or ftp.uk. Most countries have local mirrors, thus bandwidth is conserved; speeds improved.
To be able to obtain updated information on the packages APT uses a database. This database contains the packages but also which other packages are needed for that package to work (called dependencies). The program apt-get uses this database when installing your chosen packages to resolve all the dependencies and thereby to guarantee that the chosen packages will work. The updating of this database is done by the command apt-get update.
# apt-get update (which returns ) Get:1 http://sidux.com sid Release.gpg [189B] Get:2 http://sidux.com sid Release.gpg [189B] Get:3 http://sidux.com sid Release.gpg [189B] Get:4 http://ftp.de.debian.org unstable Release.gpg [189B] Get:5 http://sidux.com sid Release [34.1kB] Get:6 http://ftp.de.debian.org unstable Release [79.6kB]
Installing a new package
Presuming the Apt-database is updated and the name of the package is known, then the following command will install a package called qemu, for example, and all its dependencies: (further on you will see how to search and find packages.)
# apt-get install qemu Reading package lists... Done Building dependency tree... Done The following extra packages will be installed: bochsbios openhackware proll vgabios Recommended packages: debootstrap vde The following NEW packages will be installed: bochsbios openhackware proll qemu vgabios 0 upgraded, 5 newly installed, 0 to remove and 20 not upgraded. Need to get 4152kB of archives. After unpacking 11.9MB of additional disk space will be used. Do you want to continue [Y/n]? n
Deleting a package
Similarly it should come as no surprise that the following will deinstall the example, however it will not remove the dependencies installed above:
# apt-get remove example apt-get remove gaim Reading package lists... Done Building dependency tree... Done The following packages will be REMOVED: gaim gaim-irchelper 0 upgraded, 0 newly installed, 2 to remove and 310 not upgraded. Need to get 0B of archives. After unpacking 4743kB disk space will be freed. Do you want to continue [Y/n]? (Reading database ... 174409 files and directories currently installed.) Removing gaim-irchelper ... Removing gaim ...
In this last case the configuration files of the package 'gaim' (basically how its setup) were not deleted from the system. You could use them when installing the same package again and it would work with these settings
If you want the config files deleted also, issue this command:
# apt-get remove --purge gaim Reading package lists... Done Building dependency tree... Done The following packages will be REMOVED: gaim* 0 upgraded, 0 newly installed, 1 to remove and 309 not upgraded. Need to get 0B of archives. After unpacking 4678kB disk space will be freed. Do you want to continue [Y/n]? Y (Reading database ... 174405 files and directories currently installed.) Removing gaim ... Purging configuration files for gaim ...
Here the files in directory /etc/gaim were not only deleted, all config files were also purged/deleted, IF however an application holds or files because they were not created during the installation of the package that we want to delete, they will remain.
After the database is updated, one can find out which packages have new/newer versions: (first install apt-show-versions)
# apt-show-versions -u libpam-runtime/unstable upgradeable from 0.79-1 to 0.79-3 passwd/unstable upgradeable from 1:4.0.12-5 to 1:4.0.12-6 teclasat/unstable upgradeable from 0.7m02-1 to 0.7n01-1 libpam-modules/unstable upgradeable from 0.79-1 to 0.79-3 fonts-ttf-west-european/unstable upgradeable from 1.3-9 to 1.3-1-1 fonts-ttf-decoratives/unstable upgradeable from 1.3-1 to 1.3-1-1 sysv-rc/unstable upgradeable from 2.86.ds1-3 to 2.86.ds1-4 libpam0g/unstable upgradeable from 0.79-1 to 0.79-3 unionfs-utils/unstable upgradeable from 1.0.14+cvs2005092318w-M1 to 1.0.14+cvs2005092908w-M1libpam-runtime/unstable upgradeable from 0.79-1 to 0.79-3 passwd/unstable upgradeable from 1:4.0.12-5 to 1:4.0.12-6 teclasat/unstable upgradeable from 0.7m02-1 to 0.7n01-1 libpam-modules/unstable upgradeable from 0.79-1 to 0.79-3 fonts-ttf-west-european/unstable upgradeable from 1.3-9 to 1.3-1-1 fonts-ttf-decoratives/unstable upgradeable from 1.3-1 to 1.3-1-1 sysv-rc/unstable upgradeable from 2.86.ds1-3 to 2.86.ds1-4 libpam0g/unstable upgradeable from 0.79-1 to 0.79-3 unionfs-utils/unstable upgradeable from 1.0.14+cvs2005092318w-M1 to 1.0.14+cvs2005092908w-M1
The update of a single package including its dependencies can for example (for gcc-4.0) be done with:
apt-get install gcc-4.0 Reading package lists... Done Building dependency tree... Done gcc-4.0 is already the newest version. 0 upgraded, 0 newly installed, 0 to remove and xxx not upgraded
Downgrade and/or Hold a package
Sometimes it may be necessary to rollback to a previous version of a package or put it on hold, due to a major bug with the latest version you have just installed.
Hold
echo package hold|dpkg --set-selections
To take a package off Hold
echo package install|dpkg --set-selections
To list packages on hold:
dpkg --get-selections | grep hold
Downgrading
The steps are using kmahjongg as an example:
enable/uncomment testing sources in /etc/apt/sources.list
(delete the #) so that it reads
deb http://ftp.nl.debian.org/debian/ testing main contrib non-freeapt-get update
apt-get install -t testing kmahjongg
Put the newly installed package on hold with:
echo kmahjongg hold|dpkg --set-selectionscomment the testing sources in /etc/apt/sources.list
apt-get update
When you do want to get the latest version of the package just do this:
echo kmahjongg install|dpkg --set-selections apt-get update apt-get install kmahjongg
Upgrade of an Installed System - dist-upgrade
If the whole system is to be upgraded this is achieved through a dist-upgrade. You should always check Current Warnings on the sidux main web site, and check the warnings against the packages that your system wants to dist-upgrade. If you need to hold a package refer to Downgrade and Hold a package
An 'upgrade' only of 'debian sid' is not recommended.
Frequency of a dist-upgrade
dist-upgrade as routinely as you can, ideally once every week or two, at least 1 time per month to be safe. A dist-upgrade initiated only every 2 to 3 months should be considered the safe outer limit. For non-standard packages, or self compiled packages, you need to be much more careful with upgrading, since those may break your system at any time due to incompatibilities.
Just downloading
A little known and great option to do a check for what packages are in a dist-upgrade is the -d flag:
apt-get dist-upgrade -d
The -d allows you to download the dist-upgrade without installing it whilst in X from the konsole and allows you to do the dist-upgrade in init 3 at a later time. This also gives you the chance to check warnings against the list as it wisely gives you the option to proceed or abort like this
apt-get dist-upgrade -d
Reading package lists... Done
Building dependency tree
Reading state information... Done
Calculating upgrade... Done
The following NEW packages will be installed:
elinks-data
The following packages have been kept back:
git-core git-gui git-svn gitk icedove libmpich1.0ldbl
The following packages will be upgraded:
alsa-base bsdutils ceni configure-ndiswrapper debhelper
discover1-data elinks file fuse-utils gnucash
gnucash-common initscripts isdnutils-base libaprutil1
libcapi20-3 libdvdread3 libfuse2 libmagic1 libvlc0
linux-sound-base locales mount mozilla-plugin-vlc
python-glade2 python-gtk2 siduxcc siduxcc-common strace
sysv-rc sysvinit sysvinit-utils tzdata util-linux vlc
vlc-nox
35 upgraded, 1 newly installed, 0 to remove and 6 not upgraded.
Need to get 23.4MB of archives.
After this operation, 594kB of additional disk space will be used.
Do you want to continue [Y/n]?
Y will download the upgraded packages without touching the installed system
After the 'dist-upgrade -d' has downloaded, and wish to complete the dist-upgrade, immediately or at a later time, please follow these instructions:
Log out of KDE.
Go to Textmode by doing Ctrl+Alt+F1
logon as root,
and then type:
init 3
apt-get update
apt-get dist-upgrade
run get-sidux-binary-gfx to reinstall grahpics drivers if xorg updated and you have such a graphics adapter
otherwise do
init 5 && exit
If you do not go to init 3, well tough for you ,, you have been warned!!!!!!!!!!!!!
The Reasons NOT to use anything else but apt-get for a dist-upgrade
Package managers like adept, aptitude, synaptic and kpackage are not always able to account for the huge amount of changes which happen in Sid (depedency changes, name changes, maintainer script changes, ...). That's not the fault of the developers of those tools though, they write a excellent tools and fabulous for the debian stable branch, they are simply just not suitable for the very special needs of Debian Sid.
Use whatever you like to search for packages, but stick with apt-get for actually installing/removing/dist-upgrading
Package managers like adept, aptitude, synaptic and kpackage are at the least, non-deterministic (for complex package selection), mix that with a quickly moving target like sid and even worse an external repository of questionable quality (we don't use or recommend those, but they're a reality on your user systems) and you will be courting disaster. The other item to note is that all of these types of GUI package managers need to run in init 5, and/or, in X, and in doing a dist-upgrade in init 5 and/or X , (or even an 'upgrade' which is not recommended), you will end up damaging up your system beyond repair, maybe not today or tomorrow, in time you will.
apt-get on the other hand strictly does what it is asked to do, if there is any breakage you can pinpoint and debug/ fix the cause, if apt-get wants to remove half of the system (due to library transitions) it's the admin's call (that means you) to have at least a serious look.
This is the reason why debian builds use apt-get, not the other package manager tools.
Searching for a package with apt-cache
Another very useful command in the APT-system is apt-cache; it searches the APT-Database and shows information on packages; e.g. a list of all packages, that contain or address "sidux" and "manual" is obtained by:
$ apt-cache search sidux manual sidux-manual-de - the official de sidux manual sidux-manual-ro - the official ro sidux manual sidux-manual-hr - the official hr sidux manual sidux-manual-common - the official sidux manual - common files sidux-manual-en - the official en sidux manual sidux-manual-ru - the official ru sidux manual sidux-manual-dk - the official dk sidux manual sidux-manual - the official sidux manual - all languages sidux-manual-nl - the official nl sidux manual sidux-manual-es - the official es sidux manual
If you want more information on a particular package, you can use:
$ apt-cache show sidux-manual-en Package: sidux-manual-en Priority: optional Section: doc Installed-Size: 1088 Maintainer: Kel Modderman <kel@otaku42.de> Architecture: all Source: sidux-manual Version: 01.12.2007.06.03-1 Depends: sidux-manual-common Filename: pool/main/s/sidux-manual/sidux-manual-en_01.12.2007.06.03-1_all.deb Size: 391222 MD5sum: 60f2175c3c5709745a4b4256ccc3c49d SHA1: e275a0b27628b6aa210a4ced48d3646b438e78b8 SHA256: 2792580c7a091521301064180a1d0d8901f0a4af407b90432b9f8d8b6b3603ca Description: the official en sidux manual This manual is divided into common sections, for example, a subject pertaining to partitioning is found in Partitioning your Hard Drive, and topics regarding the Internet/WIFI are grouped in Internet and Networking. There are some topics that cannot be grouped or require stand-alone status. . As with any new documentation there will be errors/mistakes/typos, although we hope otherwise regarding errors and mistakes (typos we can live with) please forgive us. . As the body of work grows, more documentation will be added and we at sidux are sure that this will prove to be a very valuable resource for you and we thank you for being a part of sidux.
All installable versions of the package (they depend on your sources.list) can be listed by typing:
$ apt-cache policy sidux-manual-en
sidux-manual-en:
Installed: (none)
Candidate:01.12.2007.06.03-1
Version table:
01.12.2007.06.03-1 0
500 http://sidux.com sid/main Packages
A complete description of the APT-System can be found at APT-HOWTO
Searching for a package with kio-apt
Using kio-slave, Konqueror provides a non-dangerous way of using a GUI to search for packages in APT. It is a GUI search engine for packages only, without any install or upgrade options.
This is a good alternative to other package managers search functions like in adept, aptitude, synaptic and kpackage, so you will not get tempted to dist-upgrade in X or install packages using tools that are not suited for Debian sid.
You can search the package database both within APT, and/or the Debian 'package search' on the Debian web site, It makes a good summary of the pages with the information from apt-cache policy and apt-cache show.
It provides:
- apt:/search? expression:searches the package databse for 'expression'. Like apt-cache search
- apt:/show? package: shows detailed information about 'package'. Like apt-cache show. It prints the policy too.
- apt:/policy? package: shows the policy for 'package'. Like apt-cache policy.
- apt:/list? package: lists the files in 'package'.


Installation
sux apt-get update && apt-get install kio-apt
Then konqueror and type in:
apt:/
and hit the enter key. See description for all possible options which include searching with a compact form or an extended form..
A complete description of the APT-System can be found at APT-HOWTO

Search online - offline