Repositories: Difference between revisions
Prabuanand (talk | contribs) (slight rephrasing to summarise and relate world, apk and repositories) |
Prabuanand (talk | contribs) (removed changing mirror option as this is not applicable here) |
||
(3 intermediate revisions by the same user not shown) | |||
Line 5: | Line 5: | ||
== Official repositories == | == Official repositories == | ||
There are three official package repositories available in Alpine Linux i.e [[#Main|main]], [[#Community|community]] and [[#Testing|testing]]. These repositories directly correspond to three directories of [[Aports tree|aports]]. | |||
=== Main === | === 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''' 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. | ||
=== Community === | === 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. | 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. | ||
If packages from community repository are used, one needs to [[Upgrading_Alpine#Upgrading_to_latest_release|upgrade to the latest stable release branch]] to continue to have support. | |||
=== Testing === | === Testing === | ||
The ''testing'' repository is only available on [[#Edge|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 | The ''testing'' repository is only available on [[#Edge|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 are built only for [[#Edge|edge]] branch. | ||
== Release Branches == | == Release Branches == | ||
Each stable release branch of Alpine Linux has its own main and community repositories. [https://alpinelinux.org/releases/ Releases] page has information on all the release branches along with support status. Support entails security patches for the given feature versions. | |||
Support entails security patches for the given feature versions | |||
{{ | '''The current stable release branch of Alpine Linux is {{#expr:{{AlpineLatest}}}}'''. | ||
== Edge == | == Edge == | ||
''edge'' is the name given to the current [[Aports tree|development tree]] of Alpine Linux. | ''edge'' is the name given to the current [[Aports tree|development tree]] of Alpine Linux. ''edge'' branch includes all three [[#Official repositories|official repositories]] and 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 can and sometimes do break without warning. ''edge'' can be considered as '''rolling release version''' of Alpine Linux. | ||
[[#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. | [[#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}} | 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|Do not use [[#Edge|''edge'' branch]] in production, or if you desire deterministic, repeatable package installation (such as with containerized environments) via [[Alpine Package Keeper#Package pinning|package pinning]] as it is under constant development and instead use a [[#Release Branches|stable release branch]].}} | |||
{{Warning| | |||
== Managing repositories == | == Managing repositories == | ||
Line 53: | Line 46: | ||
=== Enabling the community repository === | === Enabling the community repository === | ||
[[Alpine setup scripts#setup-apkrepos|setup-apkrepos]] script can be used to enable [[#Community|community]] repository as follows: {{cmd|# setup-apkrepos -c}} | |||
{{cat|/etc/apk/repositories|#/media/cdrom/apks | With the above change, the {{path|/etc/apk/repositories}} file will look something like: {{cat|/etc/apk/repositories|#/media/cdrom/apks | ||
http://dl-cdn.alpinelinux.org/alpine/v{{#expr:{{AlpineLatest}}}}/main | http://dl-cdn.alpinelinux.org/alpine/v{{#expr:{{AlpineLatest}}}}/main | ||
http://dl-cdn.alpinelinux.org/alpine/v{{#expr:{{AlpineLatest}}}}/community}} | http://dl-cdn.alpinelinux.org/alpine/v{{#expr:{{AlpineLatest}}}}/community}} |
Latest revision as of 12:06, 9 October 2025
A repository is a storage location with a collection of Alpine Linux packages. In addition to the three official repositories, technically, any directory with a collection of *.apk files with a special index file, named APKINDEX.tar.gz can be considered a repository, albeit a personal repository. Alpine Package Keeper(apk) loads repository definitions from /etc/apk/repositories, has sub-commands to query repositories and maintain the desired system state as per world.
Official repositories
There are three official package repositories available in Alpine Linux i.e main, community and testing. These repositories directly correspond to three directories of aports.
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.
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.
If packages from community repository are used, one needs to upgrade to the latest stable release branch to continue to have support.
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 are built only for edge branch.
Release Branches
Each stable release branch of Alpine Linux has its own main and community repositories. Releases page has information on all the release branches along with support status. Support entails security patches for the given feature versions.
The current stable release branch of Alpine Linux is 3.22.
Edge
edge is the name given to the current development tree of Alpine Linux. edge branch includes all three official repositories and 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 can and sometimes do break without warning. edge can be considered as rolling release version of Alpine Linux.
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
setup-apkrepos script can be used to enable community repository as follows:
# setup-apkrepos -c
With the above change, 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.
There are only two differences:-
- When editing the /etc/apk/repositories file, all referenced repository versions (such as
v3.22
orlatest-stable
) therein need to be pointing toedge
as follows.Contents of /etc/apk/repositories
#/media/cdrom/apks http://dl-cdn.alpinelinux.org/alpine/edge/main http://dl-cdn.alpinelinux.org/alpine/edge/community @testing http://dl-cdn.alpinelinux.org/alpine/edge/testing - When the upgrade completes, edge currently issues an encouragement to run a "/usr merge" script that would update the base filesystem hierarchy:
usr_merge_nag.sh: * WARNING: The current system is not /usr-merged. You are encouraged to * migrate manually to ensure the best-possible support. See * https://alpinelinux.org/posts/2025-10-01-usr-merge.html for more details
- Applying this change should not affect general users. For background information on this process, consult the news release, including its listing of the types of installations that may be affected.
- This update is not currently a requirement but will be implemented in the future.
- To attempt its implementation with a dry run first that should foresee errors in execution:
# As per a standard system upgrade to Edge or to a new release doas apk upgrade -aU # Install the script doas apk add merge-usr # Simulate the outcome of the merge: do a "dry run". This would report any errors onscreen doas merge-usr --dryrun # If any error is reported, it would be appreciated if you could kindly open an issue at https://gitlab.alpinelinux.org/alpine/aports/–/issues/new # WARNING: The next step would be to run the script, but it is only to be run as long as the steps above were performed without any errors doas merge-usr # The script would no longer be required and may now be deleted from the system doas apk del merge-usr # Remember to sync and reboot, as per usual after a system upgrade doas sync doas reboot
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. Installing a package from testing repository that depends on libraries in main or community often won't work due to potential version mismatch. Alpine does not officially support mixing branches this way, 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).