[ previous ] [ Contents ] [ 1 ] [ 2 ] [ 3 ] [ 4 ] [ 5 ] [ 6 ] [ 7 ] [ 8 ] [ 9 ] [ 10 ] [ 11 ] [ 12 ] [ 13 ] [ next ]
Σαν μέρος της λειτουργίας του, το APT καταχωρεί σε αρχείο, ένα κατάλογο με τις 'πηγές', από τις οποίες μπορούν να αποκτώνται πακέτα. Αυτό το αρχείο είναι το /etc/apt/sources.list.
Οι καταχωρήσεις σε αυτό το αρχείο συνήθως έχουν την ακόλουθη μορφή:
deb http://host/debian distribution section1 section2 section3 deb-src http://host/debian distribution section1 section2 section3
Οι παραπάνω καταχωρήσεις είναι φυσικά φανταστικές και δεν θα πρέπει να χρησιμοποιούνται. Η πρώτη λέξη σε κάθε γραμμή, deb ή deb-src δείχνει το είδος της αρχείοθήκης: εάν δηλαδή περιέχει έτοιμα εκτελέσιμα πακέτα (deb), δηλαδή τα μεταγλωττισμένα πακέτα που χρησιμοποιούμε συνήθως, ή πηγαία πακέτα (deb-src), τα οποία αποτελούνται από τον πηγαίο κώδικα των προγραμμάτων, μαζί με το αρχείο ελέγχου του Debian (.dsc) καθώς και το αρχείο diff.gz που περιέχει τις αλλαγές που χρειάζονται, για να γίνει το πρόγραμμα κατάλληλο για τη διανομή Debian.
The word that goes where we read distribution in the above example defines what is the Debian suite we're targeting. They can be generic names, like "stable", "testing", or specific names like "sarge" and "etch". Let's say the current testing is called "etch" and you want to keep tracking "etch" even when it becomes stable; in this case you should use "etch" for distribution. In case you want to keep tracking testing you should use "testing" instead.
So, if you want to always have the latest stable distribution, and upgrade as soon as a new release is made, you should be using "stable" as distribution. This may not be a good idea, for you may want to plan the upgrade for stable releases, which sometimes involves more than simply answering a few new questions, besides doing some testing and backuping before proceeding, so I recommend you always use the codenames.
Συνήθως βρίσκουμε τα ακόλουθα στο προκαθορισμένο sources.list του Debian:
deb http://http.us.debian.org/debian stable main deb http://security.debian.org stable/updates main #deb-src http://http.us.debian.org/debian stable #deb-src http://security.debian.org stable/updates main
Αυτές είναι οι γραμμές που χρειάζονται σε μία βασική εγκατάσταση του Debian. Η πρώτη γραμμή deb μας κατευθύνει στην επίσημη αρχειοθήκη, η δεύτερη στην αρχειοθήκη εκτός Αμερικής και η τρίτη στην αρχειοθήκη των ενημερώσεων ασφαλείας του Debian.
Οι δύο τελευταίες γραμμές θεωρούνται σχόλια (έχουν ένα '#' μπροστά), έτσι το apt-get θα τις αγνοήσει. Αυτές είναι γραμμές deb-src, πράγμα που σημαίνει ότι μας κατευθύνουν στα πηγαία πακέτα του Debian. Αν κατεβάζετε συχνά πηγαίο κώδικα προγραμμάτων για δοκιμαστικούς σκοπούς ή για επανασύνθεσή τους, αφαιρέστε το '#' μπροστά από αυτές.
Το αρχείο /etc/apt/sources.list μπορεί να περιέχει διάφορους τύπους γραμμών. Το APT γνωρίζει πως να αντιμετωπίζει αρχειοθήκες τύπου http, ftp, file (τοπικά αρχεία π.χ. ένας φάκελος που περιέχει προσαρτημένο ένα σύστημα αρχείων ISO9660) και ssh, απ` όσο γνωρίζω.
Remember: everytime you want to add a source for APT to grab packages from this is the file you're going to edit.
Μην ξεχάσετε να εκτελέσετε την εντολή apt-get update αφού τροποποιήσετε το αρχείο /etc/apt/sources.list. Αυτή η ενέργεια πρέπει να γίνει για να μπορέσει το APT να αποκτήσει τον κατάλογο των διαθέσιμων πακέτων από τις πηγές που του έχετε καθορίσει.
As of APT version 0.6, packages are authenticated to ensure that they originate from the source that they claim to originate from. This is an optional security feature. If the system can't authenticate the package upon installation, it'll ask you whether or not you want to abort the installation.
Since this authentication is based on cryptographic methods, APT maintains it's own keyring. Each of the entries in your sources.list file will have a corresponding key. However, if you're using unofficial APT sources, it's possible that a source you're using won't be authenticated. If this is the case, you should encourage the maintainer of that source to implement authentication on their site.
To take advantage of this security feature, you need to add a key to APT's
keyring for each authenticated source. This can be done with GPG, but APT
provides a tool, apt-key
, which is a simplified wrapper to GPG.
apt-key
is easy to use. The tricky part of this process is
getting a key for each of your sources, and making sure that you can trust that
key.
Debian's archive key will be installed in
/usr/share/apt/debian-archive.gpg
, so you can simply use that file
to add the official archives' key to your APT keyring by doing this:
# apt-key add /usr/share/apt/debian-archive.gpg
For external, unofficial sources you'll need to find out where did they provide their public key so that you can import it into your APT keyring.
If you choose to disable the cryptographic checking of Release files for some reason you can add the following to APT's configuration (see The APT configuration file, Section 3.4):
APT::Get::AllowUnauthenticated "true";
Αν προτιμάτε να χρησιμοποιήσετε το CD-ROM σας για να εγκαταστήσετε πακέτα ή για
να αναβαθμίσετε το σύστημά σας αυτόματα με τη χρήση του APT, μπορείτε να το
βάλετε στο αρχείο σας sources.list. Για να το κάνετε αυτό,
μπορείτε να χρησιμοποιήσετε το πρόγραμμα apt-cdrom
με τον ακόλουθο
τρόπο:
# apt-cdrom add
με το CD-ROM του Debian στο δίσκο. Θα προσαρτήσει το CD-ROM και αν είναι ένα έγκυρο CD του Debian θα ψάξει για πληροφορίες πακέτων στο δίσκο. Εαν η ρύθμιση του CD-ROM σας είναι λίγο ασυνήθιστη, μπορείτε ακόμα να χρησιμοποιήσετε τις παρακάτω επιλογές:
-h - program help -d directory - CD-ROM mount point -r - Rename a recognized CD-ROM -m - No mounting -f - Fast mode, don't check package files -a - Thorough scan mode
Για παράδειγμα:
# apt-cdrom -d /home/kov/mycdrom add
Μπορείτε ακόμα να αναγνωρίσετε ένα CD-ROM, χωρίς να προστεθεί στη λίστα σας:
# apt-cdrom ident
Σημειώστε ότι αυτό το πρόγραμμα δουλεύει μόνο εάν το CD-ROM σας είναι σωστά καθορισμένο στο /etc/fstab του συστήματός σας.
APT uses /etc/apt/apt.conf
as its main configuration file.
Although, as you will find out, there's no file named like that in a default
install, you can safely create one and add your edits there. If you prefer,
there's a more modular way of handling configuration: you can place individual
files with whatever names you choose into /etc/apt/apt.conf.d/
.
Beware of two facts when you choose the modular way: some Debian packages will drop their configuration stuff into that directory, so you have to try to prevent name clashes by, for example, adding a -local suffix to the name. Also, the configuration is read ordered by the file name, so you can add a number at the very beginning of your filename to position it on the sequence. For example, you can name it 00000myconf-local if you want to make sure it will be the first configuration to be considered.
To know the syntax and options accepted by those configuration files, check out the apt.conf(5) manpage.
APT uses a prioritization algorythm to decide what repository it should grab a given package from. Here's a simple example:
$ apt-cache policy apt-howto apt-howto: Installed: 1.8.10.3-1 Candidate: 1.8.11-1 Version table: 1.8.11-1 0 500 http://ftp.nl.debian.org sid/main Packages *** 1.8.10.3-1 0 500 http://ftp.nl.debian.org sarge/main Packages 100 /var/lib/dpkg/status
I have two sources here: a sid and a sarge one, and that's all.
The installed version is marked with ***. We can see its
installed because of the mention of the /var/lib/dpkg/status
file,
too, which holds the information about the current state of the system. We can
also see that the package comes from sarge. The sid version is also listed as
available.
APT gives priority 100 for installed packages, as we can see, and 500 for all other sources with a single exception: the experimental suite, which, as we already said, is treated in a special way by many tool. APT's algorythm will prefer to install packages from sources with higher priority. If priorities are the same, then it will prefer the highest version. You can see that by looking at the Candidate field, which lists the newer version, from unstable, as candidate for instalation: it wants to upgrade it.
If you want to have the sid source only to install selected packages and don't want APT to automaticaly consider packages from that source as candidates for upgrades, then you must tweak its priorities. You do that using the Archive field of the Release file of the source you want to give priority to. You can find that information out by looking at the Release file which the update process downloaded:
$ cat /var/lib/apt/lists/ftp.debian.org.br_debian_dists_potato_main_binary-i386_Release Archive: stable Version: 2.2r3 Component: main Origin: Debian Label: Debian Architecture: i386
Notice that the filename changes depending on your source line. To make APT
keep your packages at the stable suite, then, you add a file with the following
contents to /etc/apt/apt.conf.d/
:
APT::Default-Release "testing";
Then, APT policy will have changed:
$ apt-cache policy apt-howto apt-howto: Installed: 1.8.10.3-1 Candidate: 1.8.10.3-1 Version table: 1.8.11-1 0 500 http://ftp.nl.debian.org sid/main Packages *** 1.8.10.3-1 0 990 http://ftp.nl.debian.org sarge/main Packages 100 /var/lib/dpkg/status
APT will give priority 990 for its default source for any package, the other sources remain just like before. Packages from other sources which are installed will have their priority raised from 100 to 500. Why is APT not going to downgrade them? Because APT will only consider a downgrade in case something is given a priority above 1000. That means, though, that APT will not automaticaly upgrade the versions from the non-default sources unless the tool you're using wants to try to to help you there, which is the case for aptitude.
Defining priority for groups of packages based on many other criteria is also
possible by using the /etc/apt/preferences
configuration file.
You can even convince APT to try to downgrade your whole system, althought
that's not supported and should not be tried by the faint of heart. You can
have more information about that by reading the apt_preferences(5)
manpage..
If you are using APT in a network in which all http and ftp connections are
made through a proxy, then you'll have to setup APT to use that proxy. You can
do this by editing the /etc/apt/apt.conf
configuration file or by
placing a configuration file inside the /etc/apt/apt.conf.d/
directory, which makes it is easier to organize the configuration stuff (take a
look at The APT configuration file, Section 3.4).
If that file does not exist, then create it and add lines like these:
Acquire::http::proxy "http://proxy:port"; Acquire::ftp::proxy "http://proxy:port";
Replace proxy and port for those given by your network administrator. You can also specify user and password if the proxy requires like this:
Acquire::http::proxy "http://user:password@proxy:port";
There are many other useful options you can set for APT on the
/etc/apt/apt.conf
configuration file, see The APT configuration file, Section 3.4.
[ previous ] [ Contents ] [ 1 ] [ 2 ] [ 3 ] [ 4 ] [ 5 ] [ 6 ] [ 7 ] [ 8 ] [ 9 ] [ 10 ] [ 11 ] [ 12 ] [ 13 ] [ next ]
APT HOWTO
2.0.2 - October 2006kov@debian.org
costas@step.gr