os: ubuntu - apt - sources.list
一、[wit@eagle tmp]$ man sources.list
1 SOURCES.LIST(5) APT SOURCES.LIST(5)
2
3 NAME
4 sources.list - List of configured APT data sources
5
6 DESCRIPTION
7 The source list /etc/apt/sources.list and the files contained in /etc/apt/sources.list.d/ are
8 designed to support any number of active sources and a variety of source media. The files list one
9 source per line (one-line style) or contain multiline stanzas defining one or more sources per
10 stanza (deb822 style), with the most preferred source listed first (in case a single version is
11 available from more than one source). The information available from the configured sources is
12 acquired by apt-get update (or by an equivalent command from another APT front-end).
13
14 SOURCES.LIST.D
15 The /etc/apt/sources.list.d directory provides a way to add sources.list entries in separate files.
16 Two different file formats are allowed as described in the next two sections. Filenames need to
17 have either the extension .list or .sources depending on the contained format. The filenames may
18 only contain letters (a-z and A-Z), digits (0-9), underscore (_), hyphen (-) and period (.)
19 characters. Otherwise APT will print a notice that it has ignored a file, unless that file matches
20 a pattern in the Dir::Ignore-Files-Silently configuration list - in which case it will be silently
21 ignored.
22
23 ONE-LINE-STYLE FORMAT
24 Files in this format have the extension .list. Each line specifying a source starts with a type
25 (e.g. deb-src) followed by options and arguments for this type. Individual entries cannot be
26 continued onto a following line. Empty lines are ignored, and a # character anywhere on a line
27 marks the remainder of that line as a comment. Consequently an entry can be disabled by commenting
28 out the entire line. If options should be provided they are separated by spaces and all of them
29 together are enclosed by square brackets ([]) included in the line after the type separated from it
30 with a space. If an option allows multiple values these are separated from each other with a comma
31 (,). An option name is separated from its value(s) by an equals sign (=). Multivalue options also
32 have -= and += as separators, which instead of replacing the default with the given value(s) modify
33 the default value(s) to remove or include the given values.
34
35 This is the traditional format and supported by all apt versions. Note that not all options as
36 described below are supported by all apt versions. Note also that some older applications parsing
37 this format on their own might not expect to encounter options as they were uncommon before the
38 introduction of multi-architecture support.
39
40 DEB822-STYLE FORMAT
41 Files in this format have the extension .sources. The format is similar in syntax to other files
42 used by Debian and its derivatives, such as the metadata files that apt will download from the
43 configured sources or the debian/control file in a Debian source package. Individual entries are
44 separated by an empty line; additional empty lines are ignored, and a # character at the start of
45 the line marks the entire line as a comment. An entry can hence be disabled by commenting out each
46 line belonging to the stanza, but it is usually easier to add the field "Enabled: no" to the stanza
47 to disable the entry. Removing the field or setting it to yes re-enables it. Options have the same
48 syntax as every other field: A field name separated by a colon (:) and optionally spaces from its
49 value(s). Note especially that multiple values are separated by whitespaces (like spaces, tabs and
50 newlines), not by commas as in the one-line format. Multivalue fields like Architectures also have
51 Architectures-Add and Architectures-Remove to modify the default value rather than replacing it.
52
53 This is a new format supported by apt itself since version 1.1. Previous versions ignore such files
54 with a notice message as described earlier. It is intended to make this format gradually the
55 default format, deprecating the previously described one-line-style format, as it is easier to
56 create, extend and modify for humans and machines alike especially if a lot of sources and/or
57 options are involved. Developers who are working with and/or parsing apt sources are highly
58 encouraged to add support for this format and to contact the APT team to coordinate and share this
59 work. Users can freely adopt this format already, but may encounter problems with software not
60 supporting the format yet.
61
62 THE DEB AND DEB-SRC TYPES: GENERAL FORMAT
63 The deb type references a typical two-level Debian archive, distribution/component. The
64 distribution is generally a suite name like stable or testing or a codename like bullseye or
65 bookworm while component is one of main, contrib or non-free. The deb-src type references a Debian
66 distribution's source code in the same form as the deb type. A deb-src line is required to fetch
67 source indexes.
68
69 The format for two one-line-style entries using the deb and deb-src types is:
70
71 deb [ option1=value1 option2=value2 ] uri suite [component1] [component2] [...]
72 deb-src [ option1=value1 option2=value2 ] uri suite [component1] [component2] [...]
73
74 Alternatively the equivalent entry in deb822 style looks like this:
75
76 Types: deb deb-src
77 URIs: uri
78 Suites: suite
79 Components: [component1] [component2] [...]
80 option1: value1
81 option2: value2
82
83 The URI for the deb type must specify the base of the Debian distribution, from which APT will find
84 the information it needs. suite can specify an exact path, in which case the components must be
85 omitted and suite must end with a slash (/). This is useful for the case when only a particular
86 sub-directory of the archive denoted by the URI is of interest. If suite does not specify an exact
87 path, at least one component must be present.
88
89 suite may also contain a variable, $(ARCH) which expands to the Debian architecture (such as amd64
90 or armel) used on the system. This permits architecture-independent sources.list files to be used.
91 In general this is only of interest when specifying an exact path; APT will automatically generate
92 a URI with the current architecture otherwise.
93
94 Especially in the one-line-style format since only one distribution can be specified per line it
95 may be necessary to have multiple lines for the same URI, if a subset of all available
96 distributions or components at that location is desired. APT will sort the URI list after it has
97 generated a complete set internally, and will collapse multiple references to the same Internet
98 host, for instance, into a single connection, so that it does not inefficiently establish a
99 connection, close it, do something else, and then re-establish a connection to that same host. APT
100 also parallelizes connections to different hosts to more effectively deal with sites with low
101 bandwidth.
102
103 It is important to list sources in order of preference, with the most preferred source listed
104 first. Typically this will result in sorting by speed from fastest to slowest (CD-ROM followed by
105 hosts on a local network, followed by distant Internet hosts, for example).
106
107 As an example, the sources for your distribution could look like this in one-line-style format:
108
109 deb http://us.archive.ubuntu.com/ubuntu hirsute main restricted
110 deb http://security.ubuntu.com/ubuntu hirsute-security main restricted
111 deb http://us.archive.ubuntu.com/ubuntu hirsute-updates main restricted
112
113 or like this in deb822 style format:
114
115 Types: deb
116 URIs: http://us.archive.ubuntu.com/ubuntu
117 Suites: hirsute hirsute-updates
118 Components: main restricted
119
120 Types: deb
121 URIs: http://security.ubuntu.com/ubuntu
122 Suites: hirsute-security
123 Components: main restricted
124
125 THE DEB AND DEB-SRC TYPES: OPTIONS
126 Each source entry can have options specified to modify which source is accessed and how data is
127 acquired from it. Format, syntax and names of the options vary between the one-line-style and
128 deb822-style formats as described, but they both have the same options available. For simplicity we
129 list the deb822 field name and provide the one-line name in brackets. Remember that besides setting
130 multivalue options explicitly, there is also the option to modify them based on the default, but we
131 aren't listing those names explicitly here. Unsupported options are silently ignored by all APT
132 versions.
133
134 • Architectures (arch) is a multivalue option defining for which architectures information should
135 be downloaded. If this option isn't set the default is all architectures as defined by the
136 APT::Architectures config option.
137
138 • Languages (lang) is a multivalue option defining for which languages information such as
139 translated package descriptions should be downloaded. If this option isn't set the default is
140 all languages as defined by the Acquire::Languages config option.
141
142 • Targets (target) is a multivalue option defining which download targets apt will try to acquire
143 from this source. If not specified, the default set is defined by the Acquire::IndexTargets
144 configuration scope (targets are specified by their name in the Created-By field).
145 Additionally, targets can be enabled or disabled by using the Identifier field as an option
146 with a boolean value instead of using this multivalue option.
147
148 • PDiffs (pdiffs) is a yes/no value which controls if APT should try to use PDiffs to update old
149 indexes instead of downloading the new indexes entirely. The value of this option is ignored if
150 the repository doesn't announce the availability of PDiffs. Defaults to the value of the option
151 with the same name for a specific index file defined in the Acquire::IndexTargets scope, which
152 itself defaults to the value of configuration option Acquire::PDiffs which defaults to yes.
153
154 • By-Hash (by-hash) can have the value yes, no or force and controls if APT should try to acquire
155 indexes via a URI constructed from a hashsum of the expected file instead of using the
156 well-known stable filename of the index. Using this can avoid hashsum mismatches, but requires
157 a supporting mirror. A yes or no value activates/disables the use of this feature if this
158 source indicates support for it, while force will enable the feature regardless of what the
159 source indicates. Defaults to the value of the option of the same name for a specific index
160 file defined in the Acquire::IndexTargets scope, which itself defaults to the value of
161 configuration option Acquire::By-Hash which defaults to yes.
162
163 Furthermore, there are options which if set affect all sources with the same URI and Suite, so they
164 have to be set on all such entries and can not be varied between different components. APT will try
165 to detect and error out on such anomalies.
166
167 • Allow-Insecure (allow-insecure), Allow-Weak (allow-weak) and Allow-Downgrade-To-Insecure
168 (allow-downgrade-to-insecure) are boolean values which all default to no. If set to yes they
169 circumvent parts of apt-secure(8) and should therefore not be used lightly!
170
171 • Trusted (trusted) is a tri-state value which defaults to APT deciding if a source is considered
172 trusted or if warnings should be raised before e.g. packages are installed from this source.
173 This option can be used to override that decision. The value yes tells APT always to consider
174 this source as trusted, even if it doesn't pass authentication checks. It disables parts of
175 apt-secure(8), and should therefore only be used in a local and trusted context (if at all) as
176 otherwise security is breached. The value no does the opposite, causing the source to be
177 handled as untrusted even if the authentication checks passed successfully. The default value
178 can't be set explicitly.
179
180 • Signed-By (signed-by) is an option to require a repository to pass apt-secure(8) verification
181 with a certain set of keys rather than all trusted keys apt has configured. It is specified as
182 a list of absolute paths to keyring files (have to be accessible and readable for the _apt
183 system user, so ensure everyone has read-permissions on the file) and fingerprints of keys to
184 select from these keyrings. The recommended locations for keyrings are /usr/share/keyrings for
185 keyrings managed by packages, and /etc/apt/keyrings for keyrings managed by the system
186 operator. If no keyring files are specified the default is the trusted.gpg keyring and all
187 keyrings in the trusted.gpg.d/ directory (see apt-key fingerprint). If no fingerprint is
188 specified all keys in the keyrings are selected. A fingerprint will accept also all signatures
189 by a subkey of this key, if this isn't desired an exclamation mark (!) can be appended to the
190 fingerprint to disable this behaviour. The option defaults to the value of the option with the
191 same name if set in the previously acquired Release file of this repository (only fingerprints
192 can be specified there through). Otherwise all keys in the trusted keyrings are considered
193 valid signers for this repository. The option may also be set directly to an embedded GPG
194 public key block. Special care is needed to encode the empty line with leading spaces and ".":
195
196 Types: deb
197 URIs: https://deb.debian.org
198 Suites: stable
199 Components: main contrib non-free
200 Signed-By:
201 -----BEGIN PGP PUBLIC KEY BLOCK-----
202 .
203 mDMEYCQjIxYJKwYBBAHaRw8BAQdAD/P5Nvvnvk66SxBBHDbhRml9ORg1WV5CvzKY
204 CuMfoIS0BmFiY2RlZoiQBBMWCgA4FiEErCIG1VhKWMWo2yfAREZd5NfO31cFAmAk
205 IyMCGyMFCwkIBwMFFQoJCAsFFgIDAQACHgECF4AACgkQREZd5NfO31fbOwD6ArzS
206 dM0Dkd5h2Ujy1b6KcAaVW9FOa5UNfJ9FFBtjLQEBAJ7UyWD3dZzhvlaAwunsk7DG
207 3bHcln8DMpIJVXht78sL
208 =IE0r
209 -----END PGP PUBLIC KEY BLOCK-----
210
211 • Check-Valid-Until (check-valid-until) is a yes/no value which controls if APT should try to
212 detect replay attacks. A repository creator can declare a time until which the data provided in
213 the repository should be considered valid, and if this time is reached, but no new data is
214 provided, the data is considered expired and an error is raised. Besides increasing security,
215 as a malicious attacker can't send old data forever to prevent a user from upgrading to a new
216 version, this also helps users identify mirrors which are no longer updated. However, some
217 repositories such as historic archives are not updated any more by design, so this check can be
218 disabled by setting this option to no. Defaults to the value of configuration option
219 Acquire::Check-Valid-Until which itself defaults to yes.
220
221 • Valid-Until-Min (valid-until-min) and Valid-Until-Max (valid-until-max) can be used to raise or
222 lower the time period in seconds in which the data from this repository is considered valid.
223 -Max can be especially useful if the repository provides no Valid-Until field on its Release
224 file to set your own value, while -Min can be used to increase the valid time on seldom updated
225 (local) mirrors of a more frequently updated but less accessible archive (which is in the
226 sources.list as well) instead of disabling the check entirely. Default to the value of the
227 configuration options Acquire::Min-ValidTime and Acquire::Max-ValidTime which are both unset by
228 default.
229
230 • Check-Date (check-date) is a yes/no value which controls if APT should consider the machine's
231 time correct and hence perform time related checks, such as verifying that a Release file is
232 not from the future. Disabling it also disables the Check-Valid-Until option mentioned above.
233
234 • Date-Max-Future (date-max-future) controls how far from the future a repository may be. Default
235 to the value of the configuration option Acquire::Max-FutureTime which is 10 seconds by
236 default.
237
238 • InRelease-Path (inrelease-path) determines the path to the InRelease file, relative to the
239 normal position of an InRelease file. By default, this option is unset and APT will try to
240 fetch an InRelease or, if that fails, a Release file and its associated Release.gpg file. By
241 setting this option, the specified path will be tried instead of the InRelease file, and the
242 fallback to Release files will be disabled.
243
244 URI SPECIFICATION
245 The currently recognized URI types are:
246
247 http (apt-transport-http(1))
248 The http scheme specifies an HTTP server for an archive and is the most commonly used method.
249 The URI can directly include login information if the archive requires it, but the use of
250 apt_auth.conf(5) should be preferred. The method also supports SOCKS5 and HTTP(S) proxies
251 either configured via apt-specific configuration or specified by the environment variable
252 http_proxy in the format (assuming an HTTP proxy requiring authentication)
253 http://user:pass@server:port/. The authentication details for proxies can also be supplied via
254 apt_auth.conf(5).
255
256 Note that these forms of authentication are insecure as the whole communication with the remote
257 server (or proxy) is not encrypted so a sufficiently capable attacker can observe and record
258 login as well as all other interactions. The attacker can not modify the communication through
259 as APT's data security model is independent of the chosen transport method. See apt-secure(8)
260 for details.
261
262 https (apt-transport-https(1))
263 The https scheme specifies an HTTPS server for an archive and is very similar in use and
264 available options to the http scheme. The main difference is that the communication between apt
265 and server (or proxy) is encrypted. Note that the encryption does not prevent an attacker from
266 knowing which server (or proxy) apt is communicating with and deeper analysis can potentially
267 still reveal which data was downloaded. If this is a concern the Tor-based schemes mentioned
268 further below might be a suitable alternative.
269
270 mirror, mirror+scheme (apt-transport-mirror(1))
271 The mirror scheme specifies the location of a mirrorlist. By default the scheme used for the
272 location is http, but any other scheme can be used via mirror+scheme. The mirrorlist itself can
273 contain many different URIs for mirrors the APT client can transparently pick, choose and
274 fallback between intended to help both with distributing the load over the available mirrors
275 and ensuring that clients can acquire data even if some configured mirrors are not available.
276
277 file
278 The file scheme allows an arbitrary directory in the file system to be considered an archive.
279 This is useful for NFS mounts and local mirrors or archives.
280
281 cdrom
282 The cdrom scheme allows APT to use a local CD-ROM, DVD or USB drive with media swapping. Use
283 the apt-cdrom(8) program to create cdrom entries in the source list.
284
285 ftp
286 The ftp scheme specifies an FTP server for an archive. Use of FTP is on the decline in favour
287 of http and https and many archives either never offered or are retiring FTP access. If you
288 still need this method many configuration options for it are available in the Acquire::ftp
289 scope and detailed in apt.conf(5).
290
291 Please note that an FTP proxy can be specified by using the ftp_proxy environment variable. It
292 is possible to specify an HTTP proxy (HTTP proxy servers often understand FTP URLs) using this
293 environment variable and only this environment variable. Proxies using HTTP specified in the
294 configuration file will be ignored.
295
296 copy
297 The copy scheme is identical to the file scheme except that packages are copied into the cache
298 directory instead of used directly at their location. This is useful for people using removable
299 media to copy files around with APT.
300
301 rsh, ssh
302 The rsh/ssh method invokes RSH/SSH to connect to a remote host and access the files as a given
303 user. Prior configuration of rhosts or RSA keys is recommended. The standard find and dd
304 commands are used to perform the file transfers from the remote host.
305
306 adding more recognizable URI types
307 APT can be extended with more methods shipped in other optional packages, which should follow
308 the naming scheme apt-transport-method. For instance, the APT team also maintains the package
309 apt-transport-tor, which provides access methods for HTTP and HTTPS URIs routed via the Tor
310 network.
311
312 EXAMPLES
313 Uses the archive stored locally (or NFS mounted) at /home/apt/debian for stable/main,
314 stable/contrib, and stable/non-free.
315
316 deb file:/home/apt/debian stable main contrib non-free
317
318 Types: deb
319 URIs: file:/home/apt/debian
320 Suites: stable
321 Components: main contrib non-free
322
323 As above, except this uses the unstable (development) distribution.
324
325 deb file:/home/apt/debian unstable main contrib non-free
326
327 Types: deb
328 URIs: file:/home/apt/debian
329 Suites: unstable
330 Components: main contrib non-free
331
332 Sources specification for the above.
333
334 deb-src file:/home/apt/debian unstable main contrib non-free
335
336 Types: deb-src
337 URIs: file:/home/apt/debian
338 Suites: unstable
339 Components: main contrib non-free
340
341 The first line gets package information for the architectures in APT::Architectures while the
342 second always retrieves amd64 and armel.
343
344 deb http://deb.debian.org/debian bullseye main
345 deb [ arch=amd64,armel ] http://deb.debian.org/debian bullseye main
346
347 Types: deb
348 URIs: http://deb.debian.org/debian
349 Suites: bullseye
350 Components: main
351
352 Types: deb
353 URIs: http://deb.debian.org/debian
354 Suites: bullseye
355 Components: main
356 Architectures: amd64 armel
357
358 Uses HTTP to access the archive at archive.debian.org, and uses only the hamm/main area.
359
360 deb http://archive.debian.org/debian-archive hamm main
361
362 Types: deb
363 URIs: http://archive.debian.org/debian-archive
364 Suites: hamm
365 Components: main
366
367 Uses FTP to access the archive at ftp.debian.org, under the debian directory, and uses only the
368 bullseye/contrib area.
369
370 deb ftp://ftp.debian.org/debian bullseye contrib
371
372 Types: deb
373 URIs: ftp://ftp.debian.org/debian
374 Suites: bullseye
375 Components: contrib
376
377 Uses FTP to access the archive at ftp.debian.org, under the debian directory, and uses only the
378 unstable/contrib area. If this line appears as well as the one in the previous example in
379 sources.list a single FTP session will be used for both resource lines.
380
381 deb ftp://ftp.debian.org/debian unstable contrib
382
383 Types: deb
384 URIs: ftp://ftp.debian.org/debian
385 Suites: unstable
386 Components: contrib
387
388 Uses HTTP to access the archive at ftp.tlh.debian.org, under the universe directory, and uses only
389 files found under unstable/binary-i386 on i386 machines, unstable/binary-amd64 on amd64, and so
390 forth for other supported architectures. [Note this example only illustrates how to use the
391 substitution variable; official debian archives are not structured like this]
392
393 deb http://ftp.tlh.debian.org/universe unstable/binary-$(ARCH)/
394
395 Types: deb
396 URIs: http://ftp.tlh.debian.org/universe
397 Suites: unstable/binary-$(ARCH)/
398
399 Uses HTTP to get binary packages as well as sources from the stable, testing and unstable suites
400 and the components main and contrib.
401
402 deb http://deb.debian.org/debian stable main contrib
403 deb-src http://deb.debian.org/debian stable main contrib
404 deb http://deb.debian.org/debian testing main contrib
405 deb-src http://deb.debian.org/debian testing main contrib
406 deb http://deb.debian.org/debian unstable main contrib
407 deb-src http://deb.debian.org/debian unstable main contrib
408
409 Types: deb deb-src
410 URIs: http://deb.debian.org/debian
411 Suites: stable testing unstable
412 Components: main contrib
413
414 SEE ALSO
415 apt-get(8), apt.conf(5), /usr/share/doc/apt/acquire-additional-files.md.gz
416
417 BUGS
418 APT bug page[1]. If you wish to report a bug in APT, please see
419 /usr/share/doc/debian/bug-reporting.txt or the reportbug(1) command.
420
421 AUTHORS
422 Jason Gunthorpe
423
424 APT team
425
426 NOTES
427 1. APT bug page
428 http://bugs.debian.org/src:apt
429
430 APT 2.5.3 22 February 2022 SOURCES.LIST(5)
本文由 lnlidawei 原创、整理、转载,本文来自于【博客园】; 整理和转载的文章的版权归属于【原创作者】; 转载或引用时请【保留文章的来源信息】:https://www.cnblogs.com/lnlidawei/p/17198937.html
· 分享一个免费、快速、无限量使用的满血 DeepSeek R1 模型,支持深度思考和联网搜索!
· 使用C#创建一个MCP客户端
· ollama系列1:轻松3步本地部署deepseek,普通电脑可用
· 基于 Docker 搭建 FRP 内网穿透开源项目(很简单哒)
· 按钮权限的设计及实现
2021-03-09 数学:反证法