Differences between revisions 5 and 28 (spanning 23 versions)
Revision 5 as of 2019-08-23 17:45:26
Size: 10384
Editor: nodiscc
Comment: rm self link, fix manpage link
Revision 28 as of 2020-04-16 10:47:29
Size: 11157
Comment: fix typo in link (+ man page-> manual page, apt-get update ->apt update)
Deletions are marked like this. Additions are marked like this.
Line 9: Line 9:
== Configuring Apt Sources == = Configuring Apt Sources =
Line 13: Line 13:
A source can be the official [[https://wiki.debian.org/DebianStable|Debian Stable]] repository, an additional Debian repository such as Debian [[Backports]], a local CD/DVD/directory, or a custom network/web/FTP server.


=== Editing sources directly ===

The main Apt sources configuration file is at {{{/etc/apt/sources.list}}}. Creating separate files for custom sources in files under {{{/etc/apt/sources.list.d/}}} is preferred.

You can edit the file which determines your sources directly using your favorite [[TextEditor|text editor]]. For example using {{{nano}}}: {{{nano /etc/apt/sources.list}}}
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 [[DebianReleases/PointReleases|point releases]] (security and important bug fixes every ~2 months)
 * StableUpdates: official Debian repository for changes that cannot wait for the next [[DebianReleases/PointReleases|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 ==


=== Using a graphical program ===

Some programs allow configuring Apt sources through a graphical interface. For example:

 * {{{Applications menu > Settings > Software and updates}}} ([[DebianPkg: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 [[TextEditor|text editor]].

To add custom sources, creating separate files under {{{/etc/apt/sources.list.d/}}} is preferred.
Line 24: Line 52:
=== Using a graphical program ===

Some programs allow configuring Apt sources through a graphical interface. For example:

 * {{{Applications menu > Settings > Software and updates}}} ([[DebianPkg:software-properties-gtk]] package)



== /etc/apt/sources.list ==
As part of its operation, [[Apt]] uses a file that lists the 'sources' from which packages can be obtained. This file is {{{/etc/apt/sources.list}}}.

The entries in this file normally follow this format (the entries below are fictitious and should not be used):


=== sources.list format ===

The entries in this file normally follow this format:
Line 42: Line 63:
=== Archive type === ==== Archive type ====
Line 45: Line 66:
=== Repository URL === ==== Repository URL ====
Line 48: Line 69:
=== Distribution === ==== Distribution ====
Line 54: Line 75:
=== Component === ==== Component ====
Line 61: Line 82:
== Example sources.list == === Example sources.list ===
Line 133: Line 154:
# apt-get update # apt update
Line 154: Line 175:
apt-get update apt update
Line 191: Line 212:
 * RepositoryInstructions - explains how to setup a secure third-party repository and tell users how to configure it
 * [[DebianMan:5/sources.list|sources.list(5)]] man page
 * DebianRepository/UseThirdParty - Instructions to use to a third-party repository
 * [[DebianMan:5/sources.list|sources.list(5)]] manual page

Translation(s): English - Français - Italiano - Portugês Brasileiro - Русский

Configuring Apt Sources

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

Editing software sources

Using a graphical program

Some programs allow configuring Apt sources through a graphical interface. For example:

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.

See man 5 sources.list

sources.list format

The entries in this file normally follow this format:

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

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 trixie and want to stay with it from testing to end of life, use 'trixie'.

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 10/Buster.

deb http://deb.debian.org/debian buster main
deb-src http://deb.debian.org/debian buster main

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

deb http://deb.debian.org/debian buster-updates main
deb-src http://deb.debian.org/debian buster-updates main

If you also need the contrib and non-free components, add contrib non-free after main. For example, for Debian 10/Buster:

deb http://deb.debian.org/debian buster main contrib non-free
deb-src http://deb.debian.org/debian buster main contrib non-free

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

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

If you also need the Backports, contrib, and non-free components, add buster-backports lines. For example, for Debian 10/Buster:

deb http://deb.debian.org/debian buster-backports main contrib non-free
deb-src http://deb.debian.org/debian buster-backports main contrib non-free

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.

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

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 9/Stretch:

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

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

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

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:

# apt-cdrom add

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:

# apt 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.

You can temporarily work around it by obtaining the IP address from another machine, and then using the IP address rather than the URI:

echo "deb http://128.30.2.26/debian testing main" > /etc/apt/sources.list

apt 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]    
Fetched 13.0 MB in 32s (403 kB/s)                                              
Reading package lists... Done

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 10/Buster dbgsym packages:

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

The same if you running testing.

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

And one more example if you are using the unstable distribution.

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

More information


CategoryPackageManagement