[ zurück ] [ Inhalt ] [ 1 ] [ 2 ] [ 3 ] [ 4 ] [ 5 ] [ 6 ] [ 7 ] [ 8 ] [ 9 ] [ 10 ] [ 11 ] [ 12 ] [ 13 ] [ 14 ] [ weiter ]


APT HOWTO
Kapitel 8 - Tricks and Techniques


8.1 How to install packages "on demand"

Sie kompilieren gerade ein Programm, und wie aus heiterem Himmel - Boom! Es gibt einen Fehler, da eine .h Datei gebraucht wird, die Sie nicht haben. Das Programm auto-apt kann Sie for solchen Szenarios bewahren. Es fragt, ob es die benötigten Pakete installieren soll, nachdem es den betroffenden Prozeß gestoppt hat und führt ihn fort, wenn die relevanten Pakete installiert sind.

Der Befehl sieht folgendermaßen aus:

     # auto-apt run command

Where command is the command to be executed that may need some unavailable file. For example:

     # auto-apt run ./configure

Es wird fragen, ob die benötigten Pakete installiert werden sollen, und apt-get automatisch aufrufen. Wenn X läuft, ersetzt eine grafische Oberfläche die übliche Text-Oberfläche.

Auto-apt keeps databases which need to be kept up-to-date in order for it to be effective. This is achieved by calling the commands auto-apt update, auto-apt updatedb and auto-apt update-local.


8.2 Paketverwaltung

If you are dealing with several machines in a network it might be useful to have a package caching system, so that you will not have to download the packages for each machine. This manual will focus on the apt-proxy package, which does exactly that. Other solutions exist, like apt-cacher, though. You may want to try each one to choose the one that best fits your needs.

First of all, install the apt-proxy package. It will register itself on inetd to listen for requests on port 9999, you may need to restart the inetd service.

Next you'll want to edit the /etc/apt-proxy/apt-proxy.conf file. It lists the real servers apt-proxy will use to download the package lists and packages from. You can use http, ftp and rsync as transfer methods. The file comes with a default "backend" that looks like this:

     add_backend /debian/                                    \
             $APT_PROXY_CACHE/debian/                        \
             http://ftp.us.debian.org/debian/                \
             http://ftp.de.debian.org/debian/                \
             http://ftp.uk.debian.org/debian/                \
             +ftp.us.debian.org::debian/

This means that whenever a client tries to get something from /debian/ apt-proxy will use its cache, the listed Debian http mirrors and one rsync server, which is preferred for downloading the package lists (the "+" sign means prefered for control files).

How, then, a client will use this backend? By adding the following line at the /etc/apt/sources.list file at the clients (including the box in which apt-proxy is installed):

     deb http://server:9999/debian/ stable main

The line looks much like a normal line. The difference here is you put your apt-proxy server where you would normally put an http or ftp mirror, uses a port value (9999) and then select the backend (/debian/). After having done all this initial setup update the list of packages at one of the machines and upgrade it first, so that it will only download a package one time. After the first machine is up-to-date update the others.

You can use the apt-proxy-import command to import the packages that are inside your current APT cache (/var/cache/apt/archives/) by running apt-proxy-import /var/cache/apt/archives. Notice that you must have run the update process in at least one client to initiate the apt-proxy's cache before using apt-proxy-import.

You can learn more about apt-proxy by reading the comments that populate the /etc/apt-proxy/apt-proxy.conf file. To setup http and ftp proxies for apt-proxy to use, for example, you will find example configurations at the end of the file.


8.3 Entscheidung - Welcher Mirror ist der beste für die sources.list: netselect, netselect-apt

A very frequent question, mainly among the newest users, is: "which Debian mirror to include in sources.list?". There are many ways to decide which mirror. The experts probably have a script that measures the ping time through the several mirrors. But there's a program that does this for us: netselect.

Installieren tut man netselect wie üblich:

     # apt-get install netselect

Wenn man es ohne Parameter ausführt, zeigt es seinen Hilfetext an. Führt man es mit einer durch Leerzeichen separierten Liste von Hostnamen (Mirrors) aus, gibt es uns einen Hostnamen zusammen mit der einer Punktzahl zurück. Diese Punktzahl berücksichtigt die erwarteten Pingzeit und die Zahl der Hops (Rechner, die eine Netzwerkanfrage passiert, um ihren Zielort zu erreichen) und ist antiproportional zur erwarteten Downloadgeschwindigkeit (also je niedriger, desto besser). Angezeigt wird nur der Host mit der niedrigsten Punktzahl (Die ganze Liste der Mirrors kann mit der Option -vv angesehen werden). Zum Beispiel:

     # netselect ftp.debian.org http.us.debian.org ftp.at.debian.org download.unesp.br ftp.debian.org.br
       365 ftp.debian.org.br
     #

Das bedeutet, daß von den Mirrors die als Parameter an netselect übergeben wurden, ftp.debian.org.br der beste war mit einer Punktzahl von 365. (Achtung! Weil es auf meinem Computer ausgeführt wurde und die Netzwerktopographie extrem unterschiedlich und abhängig vom Standort des Computers ist, ist dieser Wert nicht notwendigerweise die richtige Geschwindigkeit für andere Computer.

Jetzt tragen Sie einfach den schnellsten Mirror in die /etc/apt/sources.list ein (sehen Sie Die Datei /etc/apt/sources.list, Abschnitt 4.1) und befolgen Sie die Tips in Paketverwaltung, Kapitel 5.

Hinweis: Die Liste der Mirrors ist immer auf http://www.debian.org/mirror/mirrors_full zu finden.

Ab Version 0.3 enthält das netselect-Paket das netselect-apt-Script, das obigen Prozeß automatisiert. Übergeben Sie einfach die Distribution als Parameter (Der Defaultwert ist stable) und die sources.list wird mit den besten "main"- und "non-US"-Mirrors generiert und im aktuellen Verzeichnis gespeichert. Das folgende Beispiel generiert eine sources.list für die stabile Distribution:

     # ls sources.list
     ls: sources.list: File or directory not found
     # netselect-apt stable
     (...)
     # ls -l sources.list
     sources.list
     #

Hinweis: Die sources.list wird im aktuellen Verzeichnis erzeugt und muß nach /etc/apt verschoben werden.


8.4 Entfernen von unbenutzten locale-Dateien: localepurge

Viele Debian-Benutzer verwenden nur ein locale (Spracheinstellung). Ein brasilianischer Debian-Benutzer benutzt z.B. vermutlich immer das brasilianische pt_BR-locale und interessiert sich nicht für das spanische es-locale.

localepurge ist ein sehr nützliches Werkzeug für diese Art von Benutzern. Sie können eine Menge Festplattenplatz sparen, wenn Sie nur die locales installiert haben, die Sie auch wirklich brauchen. Installieren Sie einfach apt-get install localepurge.

It is very easy to configure it, debconf questions guide the user in a step-by-step configuration. Be very careful on answering the first question though, wrong answers may remove all the locales files, even the ones you use. The only way to recover these files is reinstalling all the packages that provide them.


8.5 Über Änderungen in Paketen informiert bleiben

Jedes Paket installiert in sein Dokumentationsverzeichnis (/usr/share/doc/Paketname) eine Datei mit Namen changelog.Debian.gz, welche die Liste der Änderungen gegenüber der letzten Version enthält. Sie können diese Dateien z.B. mit Hilfe von zless lesen, aber es ist nicht wirklich leicht, nach einem System-Upgrade nach dem changelog jedes aktualisierten Paketes zu suchen.

Es gibt aber eine Möglichkeit, diese Aufgabe zu automatisieren mit Hilfe eines Werkzeugs mit Namen apt-listchanges. Hierfür muß das Paket apt-listchanges erst einmal installiert werden. Während der Installation übernimmt Debconf die Installation. Beantworten Sie die Fragen nach Ihren Bedürfnissen.

The option "Should apt-listchanges be automatically run by apt?" is very useful cause it shows a list of changes made to each package that's being installed by apt during an upgrade and lets you analyze them before continuing. The option "Should apt-listchanges prompt for confirmation after displaying changes?" is useful because it asks you wether you want to continue installation after reading the list of changes. If you say that you don't want to continue apt-listchanges will return an error and apt will abort installation.

Nachdem apt-listchanges installiert wurde, zeigt es die Liste der Änderungen installierter Pakete an, wenn Pakete aus dem Netz (oder von einer CD oder gemounteten Partition) heruntergeladen werden, bevor Sie installiert werden.


[ zurück ] [ Inhalt ] [ 1 ] [ 2 ] [ 3 ] [ 4 ] [ 5 ] [ 6 ] [ 7 ] [ 8 ] [ 9 ] [ 10 ] [ 11 ] [ 12 ] [ 13 ] [ 14 ] [ weiter ]


APT HOWTO

2.0.2 - October 2006

Gustavo Noronha Silva kov@debian.org
Deutsche Übersetzung: David Spreen netzwurm@debian.org