Repositories: Difference between revisions
Prabuanand (talk | contribs) (renamed heading, rephrased and moved sentence to make things easier to follow) |
Prabuanand (talk | contribs) (made the statement consistent with apk page) |
||
(12 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
{{TOC right}} | {{TOC right}} | ||
A [https://en.wikipedia.org/wiki/Software_repository repository] is a storage location with a collection of Alpine Linux [[Alpine Package Keeper#Packages and Repositories|packages]]. [[Alpine Package Keeper|APK]] loads repository definitions from {{Path|/etc/apk/repositories}} file first and has various sub-commands to query and manipulate [[Alpine_Package_Keeper#World|world]] and package repositories. There are three official package repositories available in Alpine Linux. | |||
== Official repositories == | == Official repositories == | ||
Line 32: | Line 32: | ||
There are several release branches for Alpine Linux available at the same time. Each May and November we make a '''stable''' release branch from ''edge''. '''The current release branch of Alpine Linux is {{#expr:{{AlpineLatest}}}}'''. | There are several release branches for Alpine Linux available at the same time. Each May and November we make a '''stable''' release branch from ''edge''. '''The current release branch of Alpine Linux is {{#expr:{{AlpineLatest}}}}'''. | ||
Each stable release branch has its own main and community repositories. The '''main''' repository of every release branch is supported for 2 years. The '''community''' repository of any release branch is supported until next stable release i.e six months | Each stable release branch has its own main and community repositories. | ||
* The '''main''' repository of every release branch is supported for 2 years. | |||
* The '''community''' repository of any release branch is supported until next stable release i.e six months. | |||
Support entails security patches for the given feature versions. Security fixes beyond that can be made on request, if there are patches available. | |||
{{Note|If packages from community repository are used, one needs to [[Upgrading_Alpine#Upgrading_to_latest_release|upgrade to the latest release branch]] to continue to have support.}} | |||
== Edge == | == Edge == | ||
''edge'' is the name given to the current [[Aports tree|development tree]] of Alpine Linux. ''edge'' can be considered as '''rolling release version''' of Alpine Linux. | ''edge'' is the name given to the current [[Aports tree|development tree]] of Alpine Linux. ''edge'' can be considered as '''rolling release version''' of Alpine Linux. ''edge'' branch has all three repositories i.e '''main''', '''community''' and '''testing'''. | ||
{{Warning|''edge'' is under constant development so be careful using it in production. It is possible that bugs in ''edge'' could cause data loss or could break your system.}}'''edge''' branch contains the latest build of all available Alpine Linux packages. Those packages are updated on a regular basis. Since ''edge'' is a development branch, many changes are not heavily tested (or tested at all) and packages in ''edge'' can and sometimes do break without warning. | |||
[[#Upgrading to edge|Upgrading to Edge]] branch and/or installing packages from [[Repositories#Testing|testing]] repository and submitting '''[https://gitlab.alpinelinux.org/alpine/aports/issues bug reports]''' is one of the best ways to [[Contribute|contribute]] to Alpine Linux. This is a very valuable activity which helps Alpine Linux development, as it ensures that the quality of stable releases is high. | |||
The current installed edge version i.e the build date that is attached to the '''edge''' release may be checked with command:{{Cmd|$ cat /etc/alpine-release}} | |||
{{Warning|If you desire deterministic, repeatable package installation (such as with containerized environments) via [[Alpine Package Keeper#Package pinning|package pinning]], do not use [[#Edge|edge branch]] and instead use a package version that is intended for your [[#Release Branches|release branch]].}} | |||
== Managing repositories == | == Managing repositories == | ||
The package repositories that <code>apk</code> uses to retrieve package files for installation are specified in file {{path|/etc/apk/repositories}}. | The package repositories that <code>apk</code> uses to retrieve package files for installation are specified in file {{path|/etc/apk/repositories}}. Each line of {{path|/etc/apk/repositories}} specifies the location of a package repository, one repository per line and optionally a tag. Lines that start with a hash character (#) are ignored. | ||
The location may be an <code>http://</code> or <code>https://</code> URL, or the path to a directory on the local filesystem. If you booted from a USB stick ({{Path|/media/sda1}}) or CD-ROM ({{Path|/media/cdrom}}), your repository file probably looks something like this: {{Cat|/etc/apk/repositories|/media/sda1/apks/}} | |||
{{Tip|During [[Installation]] only the [[#Main|Main]] repository is enabled, so [[#Enabling the community repository|enable the Community repository]], if required.}} | |||
=== Enabling the community repository === | |||
To configure the repositories file {{path|/etc/apk/repositories}}, the [[Alpine setup scripts#setup-apkrepos|setup-apkrepos]] script can be used. To '''automatically''' configure the repositories issue the command: {{cmd|# setup-apkrepos -cf}} | |||
In the above command, the option '''c''' enables the community repository and '''f''' detects and adds fastest mirror. | |||
After making changes to {{path|/etc/apk/repositories}} you should update the package index using: {{cmd|# apk update}} | |||
Once the [[#Community|Community]] repository is enabled, in a properly configured Alpine Linux system , the {{path|/etc/apk/repositories}} file will look something like: | |||
{{cat|/etc/apk/repositories|#/media/cdrom/apks | {{cat|/etc/apk/repositories|#/media/cdrom/apks | ||
Line 74: | Line 83: | ||
The optional <code>@tag</code>, when used as shown above indicates that the tagged repository should not be used by default. | The optional <code>@tag</code>, when used as shown above indicates that the tagged repository should not be used by default. | ||
[[apk]] will by default only use the untagged repositories | [[apk]] will by default only use the untagged repositories, but adding a package with a @tag will make apk prefer the tagged repository for the named package, even if a later version of the package is available in another repository. It allows pulling in dependencies for the tagged package from the tagged repository (though it prefers to use untagged repositories to satisfy dependencies if possible). | ||
For eg: {{ic|apk add busybox@personal}} enables selection of {{ic|busybox}} from a tagged repository @personal. The above command allows installation of {{ic|busybox}} and it's dependencies from the tagged repository @personal. Since tagged repositories are not prioritized, if a version of {{ic|busybox}} | For eg: {{ic|apk add busybox@personal}} enables selection of {{ic|busybox}} from a tagged repository @personal. The above command allows installation of {{ic|busybox}} and it's dependencies from the tagged repository @personal. Since tagged repositories are not prioritized, if a version of {{ic|busybox's}} dependency from an untagged repository is a better fit, it will be used. | ||
=== Upgrading to edge === | === Upgrading to edge === | ||
{{:Include:Upgrading to Edge}} | {{:Include:Upgrading to Edge}} | ||
When using edge branch, [[Repositories#Testing|testing]] repository can be added as a [[Repositories#Tagged repository|tagged repository]] as shown above. Remember that, packages in [[Repositories#Testing|testing]] repository have no support. | |||
{{Warning|Do not enable Main/Community repositories from both [[Repositories#Release Branches|'''stable''' release branch]] and [[Repositories#Edge|'''edge''']] at the same time. This can break your system. Either use edge '''or''' stable. If you mix stable and edge repositories, you're on your own.}} | |||
=== Using testing repository === | === Using testing repository === | ||
Unlike [[#Edge|edge]] branch, installing packages from testing repository in a '''stable''' [[#Release Branches|release branch]] is not recommended and not guaranteed to work. However, if you need a package which is available only in the [[#Testing|testing]] repository, add '''testing''' repository as a [[#Tagged repository|tagged repository]] by editing the {{path|/etc/apk/repositories}} file as follows:{{Cat|/etc/apk/repositories|https://dl-cdn.alpinelinux.org/alpine/v{{#expr:{{AlpineLatest}}}}/main | |||
https://dl-cdn.alpinelinux.org/alpine/v{{#expr:{{AlpineLatest}}}}/community | https://dl-cdn.alpinelinux.org/alpine/v{{#expr:{{AlpineLatest}}}}/community | ||
@testing https://dl-cdn.alpinelinux.org/alpine/edge/testing}} | @testing https://dl-cdn.alpinelinux.org/alpine/edge/testing}} | ||
Before installing a package from testing repository, [[Alpine_Package_Keeper#Check_Dependencies|check for dependencies]] as mixing packages from stable and edge repositories can break your system. In the example command {{ic|# apk add wireguard-go@testing}}, the tag <code>@testing</code> allows [[apk]] to pull the necessary package(s) from testing repository without potentially messing up your installation (too badly). | |||
== See also == | == See also == | ||
Line 94: | Line 107: | ||
* [[Alpine_Package_Keeper|Alpine Package Keeper]] | * [[Alpine_Package_Keeper|Alpine Package Keeper]] | ||
* [[Alpine_Package_Keeper#World| Alpine Linux '''world''' ]] | * [[Alpine_Package_Keeper#World| Alpine Linux '''world''' ]] | ||
* [https:// | * [https://git.alpinelinux.org/apk-tools/tree/doc/apk-repositories.5.scd Manual for apk-repositories(5)] | ||
* [[Alpine Linux in a chroot]] | * [[Alpine Linux in a chroot]] | ||
* [https://bugs.alpinelinux.org/ Report Bugs] | * [https://bugs.alpinelinux.org/ Report Bugs] |
Latest revision as of 19:22, 3 October 2025
A repository is a storage location with a collection of Alpine Linux packages. APK loads repository definitions from /etc/apk/repositories file first and has various sub-commands to query and manipulate world and package repositories. There are three official package repositories available in Alpine Linux.
Official repositories
Main
Packages in main repository are the software that have direct support and updates from the Alpine core team. Alpine Linux tries to limit the amount of packages in main to only include base system packages, i.e packages which are needed by other packages or are needed to setup a basic system. Packages in main must not have dependencies in other repositories.
Packages in main repository also have official special documentation, are always available for all releases and will have substitutions if some are not continued from upstream. Commonly these packages are selected due to their responsibility and stability with respect to upstream availability. Packages from community or (rarely) testing can be accepted into the main repository.
Community
Packages in community repository are those made by users in team with the official developers and close to the Alpine package process. They are supported by those user(s) contributions and could end if the user(s) stops; they may also be removed in a future release due to lack of support by upstream authors.
The community repository was introduced with Alpine Linux version 3.3.0. Packages from testing that are accepted go to the community repository.
Testing
The testing repository is only available on edge branch i.e development branch and this is where new packages go. These are made by any contributor to Alpine Linux. Packages from testing that are accepted go to the community repository or (rarely) to the main repository. Packages in testing have no support (staging only) and only built for edge. If it stays here long enough it gets moved to unmaintained/purged (gets cleaned up every 6 months).
Before a package can move from testing to main or community, the following requirements must be met:
- Package must work correctly, including the init.d script (if provided) and default configuration.
- Packaging must be done correctly, with files installed in the right places, e.g. configs are in
/etc/
and not in/usr/etc
. - Package dependencies are handled correctly. Abuild can (and should) autodetect shared libs, for example sqlite-libs provides so:libsqlite3.so.0. Any package linked to sqlite should have an automatically (by abuild) added
depend=so:libsqlite3.so.0
and the user should not have to manually add adepend="sqlite-libs"
in the APKBUILD. - There is a maintainer who claims responsibility for the maintenance of the package and can help fix things if they break in the future.
Release Branches
There are several release branches for Alpine Linux available at the same time. Each May and November we make a stable release branch from edge. The current release branch of Alpine Linux is 3.22.
Each stable release branch has its own main and community repositories.
- The main repository of every release branch is supported for 2 years.
- The community repository of any release branch is supported until next stable release i.e six months.
Support entails security patches for the given feature versions. Security fixes beyond that can be made on request, if there are patches available.
Edge
edge is the name given to the current development tree of Alpine Linux. edge can be considered as rolling release version of Alpine Linux. edge branch has all three repositories i.e main, community and testing.

edge branch contains the latest build of all available Alpine Linux packages. Those packages are updated on a regular basis. Since edge is a development branch, many changes are not heavily tested (or tested at all) and packages in edge can and sometimes do break without warning.
Upgrading to Edge branch and/or installing packages from testing repository and submitting bug reports is one of the best ways to contribute to Alpine Linux. This is a very valuable activity which helps Alpine Linux development, as it ensures that the quality of stable releases is high.
The current installed edge version i.e the build date that is attached to the edge release may be checked with command:
$ cat /etc/alpine-release

Managing repositories
The package repositories that apk
uses to retrieve package files for installation are specified in file /etc/apk/repositories. Each line of /etc/apk/repositories specifies the location of a package repository, one repository per line and optionally a tag. Lines that start with a hash character (#) are ignored.
The location may be an http://
or https://
URL, or the path to a directory on the local filesystem. If you booted from a USB stick (/media/sda1) or CD-ROM (/media/cdrom), your repository file probably looks something like this:
Contents of /etc/apk/repositories
Enabling the community repository
To configure the repositories file /etc/apk/repositories, the setup-apkrepos script can be used. To automatically configure the repositories issue the command:
# setup-apkrepos -cf
In the above command, the option c enables the community repository and f detects and adds fastest mirror.
After making changes to /etc/apk/repositories you should update the package index using:
# apk update
Once the Community repository is enabled, in a properly configured Alpine Linux system , the /etc/apk/repositories file will look something like:
Contents of /etc/apk/repositories
Tagged repository
A tagged repository is prefixed with the @tag
specifier, followed by a space and the repository location in the /etc/apk/repositories file as follows.
Contents of /etc/apk/repositories
The optional @tag
, when used as shown above indicates that the tagged repository should not be used by default.
apk will by default only use the untagged repositories, but adding a package with a @tag will make apk prefer the tagged repository for the named package, even if a later version of the package is available in another repository. It allows pulling in dependencies for the tagged package from the tagged repository (though it prefers to use untagged repositories to satisfy dependencies if possible).
For eg: apk add busybox@personal
enables selection of busybox
from a tagged repository @personal. The above command allows installation of busybox
and it's dependencies from the tagged repository @personal. Since tagged repositories are not prioritized, if a version of busybox's
dependency from an untagged repository is a better fit, it will be used.
Upgrading to edge
An upgrade of Alpine Linux from a stable version to the rolling development version edge basically requires the same steps as Upgrading to latest release.
The crucial difference is, that when editing the /etc/apk/repositories file, all referenced repository versions (such as v3.22
or latest-stable
) therein need to be pointing to edge
as follows.
Contents of /etc/apk/repositories
When using edge branch, testing repository can be added as a tagged repository as shown above. Remember that, packages in testing repository have no support.

Using testing repository
Unlike edge branch, installing packages from testing repository in a stable release branch is not recommended and not guaranteed to work. However, if you need a package which is available only in the testing repository, add testing repository as a tagged repository by editing the /etc/apk/repositories file as follows:
Contents of /etc/apk/repositories
Before installing a package from testing repository, check for dependencies as mixing packages from stable and edge repositories can break your system. In the example command # apk add wireguard-go@testing
, the tag @testing
allows apk to pull the necessary package(s) from testing repository without potentially messing up your installation (too badly).