[ назад ] [ Содержание ] [ 1 ] [ 2 ] [ 3 ] [ 4 ] [ 5 ] [ 6 ] [ 7 ] [ 8 ] [ 9 ] [ 10 ] [ 11 ] [ 12 ] [ 13 ] [ вперед ]
Как часть своей работы, APT использует файл, содержащий список 'источников', от куда могут быть загружены пакеты. Это файл /etc/apt/sources.list.
Обычно этот файл имеет следующий формат:
deb http://host/debian distribution раздел1 раздел2 раздел3 deb-src http://host/debian distribution раздел1 раздел2 раздел3
Конечно, вышеприведенные записи являются просто примером и не должны использоваться. Первое слово в каждой строке, либо deb, либо deb-src, указывает тип пакетов в архиве: либо это двоичные пакеты (deb), т.е. предварительно скомпилированные пакеты, какие мы обычно и используем, либо исходные пакеты (deb-src), содержащие первоначальные исходные тексты программ, управляющий файл Debian (.dsc) и файл diff.gz с изменениями, необходимые для дебианизации программы, см. Сборка из исходного пакета, Глава 5.
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 помещается следующее:
deb http://http.us.debian.org/debian sarge main deb http://http.us.debian.org/debian stable 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.
Не забудьте обновить список пакетов после изменения файла /etc/apt/sources.list, см. Обновление списка доступных пакетов, раздел 4.2. Вы должны сделать это для того, чтобы система 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 Файл настроек APT, раздел 3.4):
APT::Get::AllowUnauthenticated "true";
Если вы предпочитаете использовать CD-ROM для установки пакетов или
автоматического обновления вашей системы с помощью APT, то можно добавить его в
sources.list. Для этого используется программа
apt-cdrom
:
# apt-cdrom add
Debian CD-ROM должен находиться в приводе. Программа смонтирует CD-ROM и, если диск является Debian CD, то найдет на нем информацию о пакетах. Если у вас CD-ROM необычной конфигурации, то вы можете использовать следующие опции:
-h - справка к программе -d directory - точка монтирования CD-ROM -r - Переименовать распознанный CD-ROM -m - Не монтировать -f - Ускоренный режим, не проверять пакеты файлов -a - Thorough scan mode
Например:
# apt-cdrom -d /home/kov/mycdrom add
Также вы можете идентифицировать CD-ROM без добавления его в список:
# apt-cdrom ident
Обратите внимание, что эта программа работает только, если ваш CD-ROM правильно настроен в системном файле настроек /etc/fstab.
APT использует /etc/apt/apt.conf
в качестве основного файла
настроек. Несмотря на это, в установке по умолчанию файла с таким именем нет -
вы можете благополучно его создать и внести свои правки. Но вы можете
предпочесть использовать более гибкий путь управления настройками: вы можете
поместить отдельные файлы с любыми именами в директорию
/etc/apt/apt.conf.d/
.
При выборе модульного пути вам следует помнить следующее: во-первых, некоторые пакеты Debian помещают свои файлы с настройками в этот каталог - чтобы предотвратить конфликт имён, вы можете, например, добавлять к своим файлам с настройками суффикс -local. Во-вторых, настройки из этого каталога читаются в порядке следования имён файлов, таким образом вы можете добавить число в начале имени файла, чтобы определить его место в последовательности. Например, если вы хотите, чтобы вначале рассматривались ваши настройки, то вы можете поместить их в файл с именем 00000myconf-local.
Чтобы узнать синтаксис и параметры, используемые файлами настроек, прочитайте страницу руководства apt.conf(5).
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:
# grep ^Archive /var/lib/apt/lists/ftp.nl.debian.org_debian_dists_sarge_main_binary-i386_Release Archive: stable
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 "stable";
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..
Если вы используете APT в сети, использующей прокси для http и ftp соединений,
то вам потребуется настроить APT для работы с прокси. Вы можете сделать это,
поправив файл настроек /etc/apt/apt.conf
или поместив настройки в
файл в каталоге /etc/apt/apt.conf.d/
, что позволит легче
организовать набор настроек (см. Файл настроек APT,
раздел 3.4).
Если этот файл не существует - создайте его и добавьте строки наподобие следующих:
Acquire::http::proxy "http://proxy:port"; Acquire::ftp::proxy "http://proxy:port";
Замените proxy и port настройками, предоставленными вашим сетевым администратором. Вы также можете указать следующим образом имя пользователя и пароль, если того требует прокси:
Acquire::http::proxy "http://user:password@proxy:port";
Имеется очень много полезных параметров, которыми вы можете настроить APT с
помощью файла настроек /etc/apt/apt.conf
, см. Файл настроек APT, раздел 3.4.
[ назад ] [ Содержание ] [ 1 ] [ 2 ] [ 3 ] [ 4 ] [ 5 ] [ 6 ] [ 7 ] [ 8 ] [ 9 ] [ 10 ] [ 11 ] [ 12 ] [ 13 ] [ вперед ]
APT HOWTO
2.0.2 - October 2006kov@debian.org