Linux etc apt sources list file

Repositories / CommandLine

IconsPage/terminal.png

This page describes how to manage software repositories from the command line. (GUI tools are also available: Managing Repositories in Ubuntu or Kubuntu).

IconsPage/important.png

If you are using a minimal install or server install you will need to be familiar with a terminal based text editor like nano. If you are using a GUI install you can use Nano or GEdit.

The Basics

Ubuntu uses apt for package management. Apt stores a list of repositories or software channels in the file

and in any file with the suffix .list under the directory

See man sources.list for more about this storage mechanism.

IconsPage/note.png

By editing these files from the command line, we can add, remove, or temporarily disable software repositories.

    Note: It’s always a good idea to backup a configuration file like sources.list before you edit it. To do so, issue the following command:
sudo cp /etc/apt/sources.list /etc/apt/sources.list.backup

Typically, the beginning of the file /etc/apt/sources.list looks like this:

# sources.list #deb cdrom:[Ubuntu 13.10 _Saucy Salamander_ - Release i386 (20131016.1)]/ saucy main restricted # See http://help.ubuntu.com/community/UpgradeNotes for how to upgrade to # newer versions of the distribution. deb http://ch.archive.ubuntu.com/ubuntu/ saucy main restricted deb-src http://ch.archive.ubuntu.com/ubuntu/ saucy main restricted #.

Explanation of the Repository Format

  • All the lines beginning with one or two hashes (#) are comments, for information only.
  • The lines without hashes are apt repository lines. Here’s what they say:
    • deb: These repositories contain binaries or precompiled packages. These repositories are required for most users.
    • deb-src: These repositories contain the source code of the packages. Useful for developers.
    • http://archive.ubuntu.com/ubuntu: The URI (Uniform Resource Identifier), in this case a location on the internet. See the official mirror list or the self-maintained mirror list to find other mirrors.
    • saucy is the release name or version of your distribution.
    • main & restricted are the section names or components. There can be several section names, separated by spaces.

    Other Versions

    IconsPage/note.png

    • For other Ubuntu releases you would replace the ‘saucy’ with the current version you have installed (‘precise’, ‘quantal’, ‘raring’, ‘saucy’, ‘trusty’, . ) Type lsb_release -sc to find out your release.

    Adding Repositories

    Adding the Universe and Multiverse Repositories

    deb http://us.archive.ubuntu.com/ubuntu/ saucy universe deb-src http://us.archive.ubuntu.com/ubuntu/ saucy universe deb http://us.archive.ubuntu.com/ubuntu/ saucy-updates universe deb-src http://us.archive.ubuntu.com/ubuntu/ saucy-updates universe

    There are four similar lines for ‘multiverse’.

    sudo add-apt-repository "deb http://us.archive.ubuntu.com/ubuntu/ saucy universe multiverse" sudo add-apt-repository "deb http://us.archive.ubuntu.com/ubuntu/ saucy-updates universe multiverse"

    IconsPage/note.png

    Depending on your location, you should replace ‘us.’ by another country code, referring to a mirror server in your region. Check sources.list to see what is used!

    Type lsb_release -sc to find out your release. You may repeat the commands with «deb-src» instead of «deb» in order to install the source files.

    Adding Partner Repositories

    deb http://archive.canonical.com/ubuntu saucy partner deb-src http://archive.canonical.com/ubuntu saucy partner

    IconsPage/important.png

    Be aware that the software contained within this repository is NOT open source.

Adding Other Repositories

There are some reasons for which you might want to add non-Ubuntu repositories to your list of software sources. Caution: To avoid trouble with your sytem, only add repositories that are trustworthy and that are known to work on Ubuntu systems!

    You can add custom software repositories by adding the apt repository line of your software source to the end of the sources.list file. It should look something like this:

deb http://mirror3.ubuntulinux.nl/ hardy-seveas freenx

Adding Launchpad PPA Repositories

  • The command updates your sources.list file or adds/edits files under sources.list.d/. Type man add-apt-repository for detailed help.
  • If a public key is required and available it is automatically downloaded and registered.
  • Should be installed by default. On older or minimal Ubuntu releases, you may have to install software-properties-common and/or python-software-properties first (sudo apt-get install python-software-properties)

sudo add-apt-repository ppa:

Enabling Repositories with a (non-interactive) Script

IconsPage/note.png

This section seemed obsolete due to the add-apt-repository command, thus it has been removed.

Suggestions & Recommendations

  • It is always a good idea to back up configuration files like /etc/apt/sources.list before you begin editing. You can then revert your changes if needed.
  • If you decide to add other repositories to sources.list, make sure that the repository is meant to work (and known to work) with Ubuntu. Repositories that are not designed to work with your version of Ubuntu can introduce inconsistencies in your system and might force you to re-install. Also, make sure that you really need to add external repositories as the software package(s) you are looking for may already have been introduced into the official repositories!
  • Please keep in mind that it may not be legal (typically because of export restrictions) to enable some non-Ubuntu software repositories in some countries.
  • You may be asked enter a security key when adding a non-Ubuntu repository to your sources. See Managing Authentication Keys for instructions.
  • Remember to retrieve updated package lists by issuing a sudo apt-get update when you’re done editing sources.list.

Further Reading

Repositories/CommandLine (последним исправлял пользователь 2580DCEA 2015-07-27 15:42:33)

The material on this wiki is available under a free license, see Copyright / License for details
You can contribute to this wiki, see Wiki Guide for details

Источник

Linux etc apt sources list file

Как часть своей работы, Apt использует файл содержащий список ‘источников’ из которых могут быть скачаны пакеты. Этот файл /etc/apt/sources.list.

Содержимое этого файла обычно имеет следующий формат (приведенные ниже данные являются вымышленными и не должны использоваться):

deb http://site.example.com/debian distribution component1 component2 component3 deb-src http://site.example.com/debian distribution component1 component2 component3

Тип архива

Первое слово в каждой строке, 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 12.0 «bookworm» и вы не хотите обновляться когда выйдет Debian «trixie», в таком случае нужно использовать «bookworm» вместо «trixie». Если вы всегда хотите помогать с тестированием дистрибутива, то используйте «testing». Если вы отслеживаете цикл «trixie» и хотите оставаться на нём от тестирования и до конца его жизни, используйте «trixie».

Компонент

main состоит из DFSG-compliant пакетов, которым не требуется другое ПО из других зон. Эти пакеты считаются частью дистрибуции Debian

contrib пакеты содержат DFSG-compliant ПО, но у них зависимостей из зоны main (возможно упакованы в non-free).

non-free содержит ПО, которое не соответствует DFSG.

Пример sources.list

Ниже приведен пример файла sources.list для Debian 9/Stretch.

deb http://deb.debian.org/debian/ stretch main deb-src http://deb.debian.org/debian/ stretch main deb http://deb.debian.org/debian/ stretch-updates main deb-src http://deb.debian.org/debian/ stretch-updates main deb http://security.debian.org/debian-security/ stretch/updates main deb-src http://security.debian.org/debian-security/ stretch/updates main

Если вы хотите подключить репозиторий с несвободными компонентами системы, то добавьте contrib non-free после main:

deb http://deb.debian.org/debian/ stretch main contrib non-free deb-src http://deb.debian.org/debian/ stretch main contrib non-free deb http://deb.debian.org/debian/ stretch-updates main contrib non-free deb-src http://deb.debian.org/debian/ stretch-updates main contrib non-free deb http://security.debian.org/debian-security/ stretch/updates main contrib non-free deb-src http://security.debian.org/debian-security/ stretch/updates main contrib non-free

Для редактирования вашего файла sources.list, вы можете воспользоваться утилитой software-properties-gtk. Расположенной в Menu → System → Administration → Software Sources.

gksu --desktop /usr/share/applications/software-properties.desktop /usr/bin/software-properties-gtk

Используем Tor вместе с Apt

Apt может получать и загружать обновления через Tor. Для этого вам нужно установить пакеты tor и apt-transport-tor. Затем вы можете использовать официальные onion-ресурсы в Debian.

Ниже приведен пример файла sources.list использующий onion-ресурсы в Debian 9/Stretch:

deb tor+http://vwakviie2ienjx6t.onion/debian stretch main deb-src tor+http://vwakviie2ienjx6t.onion/debian stretch main deb tor+http://vwakviie2ienjx6t.onion/debian stretch-updates main deb-src tor+http://vwakviie2ienjx6t.onion/debian stretch-updates main deb tor+http://sgvtcaew4bxjd7ln.onion/debian-security stretch/updates main deb-src tor+http://sgvtcaew4bxjd7ln.onion/debian-security stretch/updates main

CD-ROM

Если вы хотите использовать CD-ROM для установки пакетов или автоматического обновления системы через APT, то можно записать его в /etc/apt/sources.list. Для этого можно использовать программу apt-cdrom, например:

Можно использовать -d для каталога точки монтирования CD-ROM или добавить точку монтирования не-CD (т.е. USB накопитель).

Проблемы с разрешением доменных имен

Если у вас сломалось/не работает разрешение имён. Например, ниже запущен порт S/390x в QEMU Chroot:

# apt-get update 0% [Working]Unsupported socketcall: 20 Unsupported socketcall: 20 Unsupported socketcall: 20 Unsupported socketcall: 20 Unsupported socketcall: 20 Unsupported socketcall: 20 Unsupported socketcall: 20 Unsupported socketcall: 20 Err:1 http://ftp.us.debian.org/debian testing InRelease Temporary failure resolving 'ftp.us.debian.org' Reading package lists. Done W: Failed to fetch http://ftp.us.debian.org/debian/dists/testing/InRelease Temporary failure resolving 'ftp.us.debian.org' W: Some index files failed to download. They have been ignored, or old ones used instead.

Вы можете временно обойти эту проблему, указав IP адрес репозитория (получив его с другой машны):

echo "deb http://128.30.2.26/debian testing main contrib" > /etc/apt/sources.list apt-get update Get:1 http://128.30.2.26/debian testing InRelease [232 kB] Get:2 http://128.30.2.26/debian testing/main s390x Packages [7583 kB] Get:3 http://128.30.2.26/debian testing/main Translation-en [5134 kB] Get:4 http://128.30.2.26/debian testing/contrib s390x Packages [42.7 kB] Get:5 http://128.30.2.26/debian testing/contrib Translation-en [44.7 kB] Fetched 13.0 MB in 32s (403 kB/s) Reading package lists. Done

Debug Symbol Packages

Для отладки аварийных остановок работы программ часто требуются соответствующие файлы символов отладки. Для большинства пакетов Debian они находятся в пакетах dbgsym. Они доступны из отдельного архива.

Ниже приведен пример файла sources.list для dbgsym-пакетов Debian 9/Stretch:

deb http://deb.debian.org/debian-debug/ stretch-debug main

Подробнее

  • sources.list(5) man page
  • Список неофициальных репозиториев, что-бы получить дополнительные программы ( Skype, Opera, Google )
  • AptCLI
  • AptPreferences
  • APT HOWTO
  • поиск по неофициальным репозиториям (восновном очень старые пакеты)
  • Debian на CD/DVD
  • Добавление списка источников, в том числе cd, используя apt-setup
  • deb.debian.org

Источник

Читайте также:  Настройка linux freebsd серверов
Оцените статью
Adblock
detector