lihongjie0209 / myblog

4 stars 0 forks source link

Debian 仓库工作原理 #250

Open lihongjie0209 opened 3 years ago

lihongjie0209 commented 3 years ago

apt配置仓库

The format for two one-line-style entries using the deb and deb-src types is:

deb [ option1=value1 option2=value2 ] uri suite [component1] [component2] [...]
deb-src [ option1=value1 option2=value2 ] uri suite [component1] [component2] [...]

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

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.

The easiest way to understand the repository directory structure is to consider two typical lines in the /etc/apt/sources.list file:

deb http://chaos/debian    unstable    main local unofficial
    ------ base -------  distribution  ---- components -----

deb-src http://chaos/debian    unstable    main local unofficial
        ------ base -------  distribution  ---- components -----

deb http://non-us.debian.org/debian-non-US  stable/non-US  main contrib
    ---------------- base ----------------  distribution   -components-

The base can be http:, ftp: or file: URI.

The distribution is usually stable, frozen or unstable for official Debian releases, but it can be anything. The distribution may specify multiple directory levels.

The component is usually main, contrib or non-free in official Debian releases. Other common components are local (for internal use only) and unofficial (for distribution). Again, this string can be anything.

lihongjie0209 commented 3 years ago

服务器端目录结构

base/dists/distribution/component/binary-all/Packages.gz
----       ------------ ---------           /admin/binary-packages
                                            /base/binary-packages
                                            /comm/binary-packages
                                            ...
                                            /Release
                                 /binary-i386/Packages.gz
                                             /admin/binary-packages
                                             /base/binary-packages
                                             /comm/binary-packages
                                             ...
                                             /Release
                                 /binary-sparc/...
                                 /binary-arm/...
                                 /binary-ia86/...
                                 /source/Sources.gz
                                         /admin/binary-packages
                                         /base/binary-packages
                                         /comm/binary-packages
                                         ...
                                         /Release

Release component metadata

http://ftp.debian.org/debian/dists/buster/main/binary-amd64/Release

Archive: stable
Origin: Debian
Label: Debian
Version: 10.7
Acquire-By-Hash: yes
Component: main
Architecture: amd64

Packages.gz deb数据库

示例

Package: 0ad
Version: 0.0.23.1-2
Installed-Size: 19837
Maintainer: Debian Games Team <pkg-games-devel@lists.alioth.debian.org>
Architecture: amd64
Depends: 0ad-data (>= 0.0.23.1), 0ad-data (<= 0.0.23.1-2), 0ad-data-common (>= 0.0.23.1), 0ad-data-common (<= 0.0.23.1-2), libboost-filesystem1.67.0, libboost-system1.67.0, libc6 (>= 2.27), libcurl3-gnutls (>= 7.16.2), libenet7, libgcc1 (>= 1:3.4), libgl1, libgloox17, libicu63 (>= 63.1-1~), libminiupnpc17 (>= 1.9.20140610), libnspr4 (>= 2:4.9.2), libnvtt2, libopenal1 (>= 1.14), libpng16-16 (>= 1.6.2-1), libsdl2-2.0-0 (>= 2.0.8), libsodium23 (>= 1.0.14), libstdc++6 (>= 5.2), libvorbisfile3 (>= 1.1.2), libwxbase3.0-0v5 (>= 3.0.4+dfsg), libwxgtk3.0-0v5 (>= 3.0.4+dfsg), libx11-6, libxcursor1 (>> 1.1.2), libxml2 (>= 2.9.0), zlib1g (>= 1:1.2.0)
Pre-Depends: dpkg (>= 1.15.6~)
Description: Real-time strategy game of ancient warfare
Homepage: http://play0ad.com/
Description-md5: d943033bedada21853d2ae54a2578a7b
Tag: game::strategy, interface::graphical, interface::x11, role::program,
 uitoolkit::sdl, uitoolkit::wxwidgets, use::gameplaying,
 x11::application
Section: games
Priority: optional
Filename: pool/main/0/0ad/0ad_0.0.23.1-2_amd64.deb
Size: 5471488
MD5sum: 4e9a3f5ddaba8bfc5c41980706f3910e
SHA256: fb5c3af6d1d7cd7f1d3e8d2e04c1b8605b8c38f85e5c285a21c56eaf72f2bb47

下载的时候把base + filename (pool/main/0/0ad/0ad_0.0.23.1-2_amd64.deb) 就是最终的下载地址