- SourcesList
- Commonly used package sources
- Editing software sources
- Precautions
- Using a graphical program
- Using a text editor
- sources.list format
- Archive type
- Repository URL
- Distribution
- Component
- Example sources.list
- Using Tor with Apt
- CD-ROM
- Name Resolution
- Debug Symbol Packages
- More information
- ru SourcesList
- /etc/apt/sources.list
- Тип архива
- URL Репозитория
- Дистрибутив
- Компонент
- Пример sources.list
- Используем Tor вместе с Apt
- CD-ROM
- Проблемы с разрешением доменных имен
- Debug Symbol Packages
- Подробнее
- Как добавить репозиторий в Debian
- Как добавить репозитории в Debian
- 1. Файл /etc/apt/sources.list
- 2. Папка /etc/apt/sources.list.d/
- 3. Команда apt-add-repository
- Выводы
- SourcesList
Apt downloads packages from one or more software repositories (sources) and installs them onto your computer.
A repository is generally a network server, such as the official DebianStable repository. Local directories or CD/DVD are also accepted.
The specific repositories (package sources) configured on your machine affect:
- What software packages are available for download
- What versions of packages are available
- Who packages the software
Commonly used package sources
DebianStable: official Debian repository for the current release
StableProposedUpdates: official Debian repository for upcoming point releases (security and important bug fixes every
StableUpdates: official Debian repository for changes that cannot wait for the next point release, packages are also added to StableProposedUpdates for inclusion in the next point release
DebianSecurity: official Debian repository for frequent security updates
DebianBackports: more recent versions of some packages, compatible with DebianStable.
DebianTesting: current development state of the next stable Debian distribution
DebianUnstable: rolling development version containing the latest packages
DebianExperimental: development version containing the experimental/alpha/beta/untested packages
Editing software sources
Precautions
Being able to change the repositories used by your package management system is a powerful feature but this power comes with some responsibility. Users are cautioned that it is possible to break your system (in a way that could be difficult or impossible to cleanly fix) by adding third-party repositories, or repositories for a Debian version that does not match your current version — these repository create a risk of conflicting package versions, creating what’s sometimes called a «Franken-Debian» system. The whole concept behind a Debian stable release is that the Debian developers have picked a set of software and their versions that function nicely together. While this software is patched to fix security issues, the software is frequently not the latest version. It takes some experience to know how the repos may be changed without risk of breaking your system. Users of all levels are advised to change repos cautiously.
Using a graphical program
Some programs allow configuring Apt sources through a graphical interface. For example:
Applications menu > Settings > Software and updates (software-properties-gtk package)
Using a text editor
The main Apt sources configuration file is at /etc/apt/sources.list. You can edit this files (as root) using your favorite text editor.
To add custom sources, creating separate files under /etc/apt/sources.list.d/ is preferred.
sources.list format
The entries in this file normally follow this format:
Archive type
The first word on each line, deb or deb-src, indicates the type of archive. Deb indicates that the archive contains binary packages (deb), the pre-compiled packages that we normally use. Deb-src indicates source packages, which are the original program sources plus the Debian control file (.dsc) and the diff.gz containing the changes needed for packaging the program.
Repository URL
The next entry on the line is a URL to the repository that you want to download the packages from. The main list of Debian repository mirrors is located here.
Distribution
The ‘distribution’ can be either the release code name / alias (jessie, stretch, buster, sid) or the release class (oldstable, stable, testing, unstable) respectively. If you mean to be tracking a release class then use the class name, if you want to track a Debian point release, use the code name. Avoid using stable in your sources.list as that results in nasty surprises and broken systems when the next release is made; upgrading to a new release should be a deliberate, careful action and editing a file once every two years is not a burden.
For example, if you always want to help test the testing release, use ‘testing’. If you are tracking bookworm and want to stay with it from testing to end of life, use ‘bookworm’.
Component
main consists of DFSG-compliant packages, which do not rely on software outside this area to operate. These are the only packages considered part of the Debian distribution.
contrib packages contain DFSG-compliant software, but have dependencies not in main (possibly packaged for Debian in non-free).
non-free contains software that does not comply with the DFSG.
Example sources.list
Below is an example of a sources.list for Debian 11/Bullseye.
If you also need the contrib and non-free components, add contrib non-free after main. For example, for Debian 11/Bullseye:
If you also need the Backports, contrib, and non-free components, add bullseye-backports lines. For example, for Debian 11/Bullseye:
You can instead use https://. in all of the above lines to use the repositories over encrypted HTTPS connections if the according mirror supports HTTPS. (Users of Debian 9/Stretch or older releases will need to install the apt-transport-https package first. The security.debian.org hosts currently do not have publicly verifiable SSL certificates on HTTPS and hence cannot be used with HTTPS at the moment.)
You can use a GNOME tool to edit your sources.list file. Access it through Menu → System → Administration → Software Sources.
Using Tor with Apt
Apt can retrieve and download updates through Tor. For this to work you need to install the tor and apt-transport-tor packages. You can then use the official onion services provided by Debian.
Here is an example sources.list using the onion services for Debian 11/Bullseye:
CD-ROM
If you’d rather use your CD-ROM for installing packages or updating your system automatically with APT, you can put it in your /etc/apt/sources.list. To do so, you can use the apt-cdrom program like this:
with the Debian CD-ROM in the drive.
You can use -d for the directory of the CD-ROM mount point or add a non-CD mount point (i.e. a USB keydrive).
Name Resolution
On occasion name resolution can break. For example, below is from a S/390x Port running in a QEMU Chroot:
You can temporarily work around it by obtaining the IP address from another machine, and then using the IP address rather than the URI:
Debug Symbol Packages
To debug a crash you often need the related debug symbol files. For most Debian packages these are in dbgsym packages. These are available from a separate archive.
Here is an example entry for your sources.list for Debian 11/Bullseye dbgsym packages:
The same if you running testing.
And one more example if you are using the unstable distribution.
More information
A list of UnofficialRepositories to get extra software ( Skype, Opera, Google )
DebianRepository/UseThirdParty — Instructions to use to a third-party repository
Источник
- ru
- SourcesList
/etc/apt/sources.list
Как часть своей работы, Apt использует файл содержащий список ‘источников’ из которых могут быть скачаны пакеты. Этот файл /etc/apt/sources.list.
Содержимое этого файла обычно имеет следующий формат (приведенные ниже данные являются вымышленными и не должны использоваться):
Тип архива
Первое слово в каждой строке, deb или deb-src, указывает тип архива. Deb указывает что архив содержит бинарные пакеты (deb), пре-компилированные пакеты для нормального использования. Deb-src указывает что это архив пакетов с иходным кодом, который содержит оригинальные исходные коды программ плюс контрольный файл Debian (.dsc) и diff.gz содержащий изменения и необходимый для пакетирования программы.
URL Репозитория
Следующая запись в строке это адрес (URL) репозитория с которого вы хотите скачивать пакеты. Основной список зеркал репозитория Debian находитсяздесь.
Дистрибутив
‘distribution’ может быть либо кодовое имя / псевдоним релиза (jessie, stretch, buster, sid), либо класс релиза (stable, oldstable, testing, unstable). Если вы имеете в виду отслеживание класса релиза, а затем хотите использовать название релиза, или же если вы просто хотите отслеживать цикл релизов Debian, то используйте кодовое имя.
Например, если у вас есть система работающая на Debian 11.1 «bullseye» и вы не хотите обновляться когда выйдет Debian «bookworm», в таком случае нужно использовать «bullseye» вместо «bookworm». Если вы всегда хотите помогать с тестированием дистрибутива, то используйте «testing». Если вы отслеживаете цикл «bookworm» и хотите оставаться на нём от тестирования и до конца его жизни, используйте «bookworm».
Компонент
main состоит из DFSG-compliant пакетов, которым не требуется другое ПО из других зон. Эти пакеты считаются частью дистрибуции Debian
contrib пакеты содержат DFSG-compliant ПО, но у них зависимостей из зоны main (возможно упакованы в non-free).
non-free содержит ПО, которое не соответствует DFSG.
Пример sources.list
Ниже приведен пример файла sources.list для Debian 9/Stretch.
Если вы хотите подключить репозиторий с несвободными компонентами системы, то добавьте contrib non-free после main:
Для редактирования вашего файла sources.list, вы можете воспользоваться утилитой software-properties-gtk. Расположенной в Menu → System → Administration → Software Sources.
Используем Tor вместе с Apt
Apt может получать и загружать обновления через Tor. Для этого вам нужно установить пакеты tor и apt-transport-tor. Затем вы можете использовать официальные onion-ресурсы в Debian.
Ниже приведен пример файла sources.list использующий onion-ресурсы в Debian 9/Stretch:
CD-ROM
Если вы хотите использовать CD-ROM для установки пакетов или автоматического обновления системы через APT, то можно записать его в /etc/apt/sources.list. Для этого можно использовать программу apt-cdrom, например:
Можно использовать -d для каталога точки монтирования CD-ROM или добавить точку монтирования не-CD (т.е. USB накопитель).
Проблемы с разрешением доменных имен
Если у вас сломалось/не работает разрешение имён. Например, ниже запущен порт S/390x в QEMU Chroot:
Вы можете временно обойти эту проблему, указав IP адрес репозитория (получив его с другой машны):
Debug Symbol Packages
Для отладки аварийных остановок работы программ часто требуются соответствующие файлы символов отладки. Для большинства пакетов Debian они находятся в пакетах dbgsym. Они доступны из отдельного архива.
Ниже приведен пример файла sources.list для dbgsym-пакетов Debian 9/Stretch:
Подробнее
Список неофициальных репозиториев, что-бы получить дополнительные программы ( Skype, Opera, Google )
Источник
Как добавить репозиторий в Debian
Репозитории — это сетевые хранилища программного обеспечения. Они используются в дистрибутивах Linux, и в том числе в Debian для быстрой установки программного обеспечения с помощью пакетного менеджера. Более подробно о том какие репозитории бывают и зачем они нужны написано в статье Репозитории Debian.
В этой же статье мы поговорим о том как добавить репозитории в Debian различными способами. Самый простой и часто используемый вариант — настройка репозиториев вручную, с него мы и начнём.
Как добавить репозитории в Debian
Новички часто сталкиваются с проблемой, что после установки новой системы пакетный менеджер не может найти ни одного пакета. Это связано с тем, что по умолчанию основные репозитории Debian в систему не добавлены, там есть только репозитории из DVD дисков с помощью которых вы устанавливали систему. Эта проблема очень просто решается. Системные репозитории находятся в файле /etc/apt/sources.list. Давайте сначала посмотрим на содержимое этого файла по умолчанию:
sudo vi /etc/apt/sources.list
Синтаксис строки репозитория такой:
тип адрес дистрибутив ветка_1 ветка_2
Типов репозиториев может быть два. Это deb и deb-src. Первый — для бинарных файлов, второй — для файлов исходных кодов. Дистрибутив указывает кодовое имя дистрибутива, например, для Debian 10 — это buster, для девятой версии stretch. Для стабильных обновлений есть еще один репозиторий, где вместе с кодовым именем дистрибутива указывается слово updates, например: buster-updates.
Веток есть всего три, вот они:
- main — полностью свободные пакеты, это основа дистрибутива Debian;
- contrib — свободные пакеты, которые могут зависеть от несвободных;
- non-free — все остальные несвободные пакеты.
Основы разобрали, теперь давайте посмотрим как добавить репозитории.
1. Файл /etc/apt/sources.list
Именно в этот файл репозиториев Debian надо добавлять системные репозитории. Чтобы получить доступ ко всем системным пакетам надо добавить репозиторий stable, со стабильной версией Debian, и репозиторий стабильных обновлений. Вот так будут выглядеть их строчки:
deb http://deb.debian.org/debian/ buster main contrib non-free
deb http://deb.debian.org/debian/ buster-updates main contrib non-free
Просто добавьте их в конец файла /etc/apt/sources.list. Вы уже знаете какая часть за что отвечает и сможете разобраться. Если вы захотите добавить репозиторий Backports или Testing, то вам тоже следует использовать этот файл.
2. Папка /etc/apt/sources.list.d/
Сторонние репозитории тоже можно добавить в основной системный файл, но этого делать не следует, чтобы не засорять его лишними строками. Для сторонних репозиториев была придумана директория /etc/apt/sources.list.d/. В ней надо создать файл с именем репозитория и расширением .list, а затем добавить в неё репозиторий, как это делалось с основным конфигурационным файлом. Например, для браузера Chrome:
sudo vi /etc/apt/sources.list.d/google-chrome.list
deb http://dl.google.com/linux/chrome/deb/ stable main
Касательно сторонних репозиториев, есть ещё один момент. По умолчанию система не может им доверять, и для того чтобы это исправить нужно импортировать ключ репозитория. Обычно ключи можно найти на сайте, где вы нашли сам репозиторий, для того же Google Chrome ключ можно импортировать командой:
wget -q -O — https://dl-ssl.google.com/linux/linux_signing_key.pub | sudo apt-key add —
После добавления репозитория, прежде чем вы сможете установить пакет, необходимо обновить списки пакетов. Для этого выполните:
sudo apt update
3. Команда apt-add-repository
Эта команда делает то же самое, что мы делали вручную на первом шаге. Она добавляет репозиторий в /etc/apt/sources.list. Отлично подходит для добавления системных репозиториев. Для сторонних репозиториев её можно использовать не всегда, поскольку она добавляет кодовое имя дистрибутива в строку репозитория, а это может её сломать, если владельцами репозитория такое явно не было задумано. Например, с помощью этой команды вы можете добавить testing репозиторий:
sudo apt-add-repository ‘deb http://ftp.ru.debian.org/debian/ testing main non-free contrib’
А потом удалить, если он больше не нужен:
sudo apt-add-repository —remove ‘deb http://ftp.ru.debian.org/debian/ testing main non-free contrib’
Выводы
В этой небольшой статье мы рассмотрели добавление репозиториев Debian на примере операционной системы Debian 10. Как видите, для этого есть несколько способов и какой из них вы будете использовать зависит от вас. А как добавляете репозитории вы? Напишите в комментариях!
Источник