Repositories: Difference between revisions

From Alpine Linux
(add note about the mirrors page)
(moved content from Alpine_Package_Keeper to consolidate repository information)
 
(28 intermediate revisions by 8 users not shown)
Line 1: Line 1:
{{TOC right}}
{{TOC right}}


The Alpine software repositories have three branches:
== Repositories ==


* '''main''' packages are the software that have direct support and updates from the Alpine core and main team. They 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'', that are accepted go to the ''main'' branch.
There are three package repositories in Alpine Linux:


* '''community''' packages 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 from ''testing'' that are accepted go to the ''community'' branch.
=== Main ===


* '''testing''' packages are where new packages go. These are made by any contributor to Alpine. Testing has no release linked. The ''testing'' repository is only available on ''edge''. Packages from ''testing'' that are accepted go to the ''community'' branch or (rarely) the ''main'' branch.
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.


= Overview =
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.


To enable a repository, remove the '''#''' in front of the URL along with any blank space.
=== Community ===


Example: Disabled
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.  
{{cat|/etc/apk/repositories|#http://dl-cdn.alpinelinux.org/alpine/v3.16/community}}


Example: Enabled
The '''community''' repository was introduced with Alpine Linux version [https://alpinelinux.org/posts/Alpine-3.3.0-released.html 3.3.0]. Packages from ''testing'' that are accepted go to the ''community'' repository.
{{cat|/etc/apk/repositories|http://dl-cdn.alpinelinux.org/alpine/v3.16/community}}


To edit the repositories, open the <code>/etc/apk/repositories</code> file in a text editor:
=== Testing ===


{{cmd|# <editor> /etc/apk/repositories}}
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. .  Packages from ''testing'' that are accepted go to the ''community'' repository or (rarely) 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).


The default will look something like:
Before a package can move from ''testing'' to ''main'' or ''community'', the following requirements must be met:


{{cat|/etc/apk/repositories|#/media/cdrom/apks
# Package must work correctly, including the init.d script (if provided) and default configuration.
http://dl-cdn.alpinelinux.org/alpine/v3.16/main
# Packaging must be done correctly, with files installed in the right places, e.g. configs are in <code>/etc/</code> and not in <code>/usr/etc</code>.
#http://dl-cdn.alpinelinux.org/alpine/v3.16/community
# 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 <code>depend=so:libsqlite3.so.0</code> and the user should not have to manually add a <code>depend="sqlite-libs"</code> in the APKBUILD.
#http://dl-cdn.alpinelinux.org/alpine/edge/main
# There is a maintainer who claims responsibility for the maintenance of the package and can help fix things if they break in the future.
#http://dl-cdn.alpinelinux.org/alpine/edge/community
#http://dl-cdn.alpinelinux.org/alpine/edge/testing}}


You should probably change the url's from '''http''' to '''https'''[https://en.wikipedia.org/wiki/HTTPS#Technical].


{{Note|Some Alpine Linux package mirrors may not support HTTPS. If that is the case, you will need to change mirrors or revert back. You can check if your mirror supports HTTPS on https://mirrors.alpinelinux.org }}
== Release Branches ==


<br>
There are several release branches for Alpine Linux available at the same time. Each May and November we make a release branch from ''edge''. '''The current release branch of Alpine Linux is {{#expr:{{AlpineLatest}}}}'''.


You can avoid having to manually update the version in <code>/etc/apk/repositories</code> for each Alpine Linux release by changing <code>v3.16</code> to <code>latest-stable</code>.
The '''main''' repository of every release branch is typically supported for 2 years. The '''community''' repository of any release branch is supported until next stable release i.e six months. Security fixes beyond that can be made on request when there are patches available.  


Example:
{{Note|If packages from community repository are used, one needs to update to the latest release branch to continue to have support.}}
{{cat|/etc/apk/repositories|#/media/cdrom/apks
https://dl-cdn.alpinelinux.org/alpine/latest-stable/main
https://dl-cdn.alpinelinux.org/alpine/latest-stable/community
#http://dl-cdn.alpinelinux.org/alpine/edge/main
#http://dl-cdn.alpinelinux.org/alpine/edge/community
#http://dl-cdn.alpinelinux.org/alpine/edge/testing}}


{{Warning|Changing the repositories to <code>latest-stable</code> may initiate unexpected release upgrades.}}
'''To upgrade''' to the latest release branch, follow the steps in  [[Upgrading_Alpine#Upgrading_to_latest_release|Upgrading Alpine Linux]].


= Release Branches =
== Edge==


There are several release branches for Alpine Linux available at the same time. Each May and November we make a release branch from '''edge'''. The '''main''' repository is typically supported for 2 years and the '''community''' repository is supported until next stable release.
''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. This version contains the latest build of all available Alpine Linux packages. Those packages are updated on a regular basis.  


Security fixes beyond that can be made on request when there are patches available.
<br>


== Main ==
{{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.}}


By default only the '''main''' repository is enabled. ''main'' has a support cycle of 2 years. We also try to limit the amount of packages in ''main'' to only include base system packages, in base you can think of 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.
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. However, testing ''edge'' is a very valuable activity which helps the Alpine Linux development to ensure that the quality of the stable releases is high. Testing ''edge'' is a great way to contribute to the Alpine Linux development.


== Community ==
Similar to [[#Release Branches|release branches]] edge consists of '''main''' and '''community'''  repositories in addition to the third repository i.e '''testing'''.


The '''community''' repository was introduced with Alpine Linux version [https://alpinelinux.org/posts/Alpine-3.3.0-released.html 3.3.0].  ''community'' has a maximum support cycle of 6 months. After that you will need to update to the new release to continue to have support.
== Managing repositories ==
The package repositories that <code>apk</code> uses to retrieve package files for installation are specified in file {{path|/etc/apk/repositories}}. To '''automatically''' configure the repositories file {{path|/etc/apk/repositories}}, use the  [[Alpine setup scripts#setup-apkrepos|setup-apkrepos]] script:
{{cmd|# setup-apkrepos -cf}}


=== Enabling the community repository ===
After making changes to {{path|/etc/apk/repositories}} you should update the package index using:
{{cmd|# apk update}}


To enable the repository, edit the file <code>/etc/apk/repositories</code> and add (or uncomment) a line that points to the "community" directory.
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.


Its format is:
The location may be an <code>http://</code> or <code>https://</code> URL, or the path to a directory on the local filesystem. A [[Package_management#Repository_pinning|tagged]] repository is prefixed with the <code>@tag</code> specifier, followed by a space and the repository location.


<nowiki>https://<mirror-server>/alpine/<version>/community</nowiki>
If you booted from a USB stick ({{Path|/media/sda1}}) or CD-ROM ({{Path|/media/cdrom}}), your repository file probably looks something like this:


For example, if your mirror is dl-cdn.alpinelinux.org and you're on version 3.16, add the following line to the repositories file:
{{Cat|/etc/apk/repositories|/media/sda1/apks/}}


<nowiki>https://dl-cdn.alpinelinux.org/alpine/v3.16/community</nowiki>
In a properly configured Alpine Linux system, the default will look something like:


After enabling the community repository, one needs to update the index of available packages with:
{{cat|/etc/apk/repositories|#/media/cdrom/apks
{{Cmd|# apk update}}
http://dl-cdn.alpinelinux.org/alpine/v{{#expr:{{AlpineLatest}}}}/main
And then it's possible to install packages from the community repository.
http://dl-cdn.alpinelinux.org/alpine/v{{#expr:{{AlpineLatest}}}}/community}}


= Edge =
{{Note| For better security you should probably change the url's from '''http''' to '''https'''. Some Alpine Linux package mirrors may not support '''https'''. If that is the case, you will need to change mirrors or revert back. You can check if your mirror supports '''https''' on https://mirrors.alpinelinux.org }}


''edge'' is the name given to the current [[Aports tree|development tree]] of Alpine Linux. It consists of an APK repository called ''edge'' and contains the latest build of all available Alpine Linux packages. Those packages are updated on a regular basis.
=== Repository pinning ===


{{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.}}
You can specify additional "tagged" repositories in {{Path|/etc/apk/repositories}}:
 
{{Cat|/etc/apk/repositories|
https://dl-cdn.alpinelinux.org/alpine/v3.18/main
https://dl-cdn.alpinelinux.org/alpine/v3.18/community
@personal https:/personal-repo.example.com/alpine-apks/
}}
 
After which you can "pin" dependencies to these tags using:


End users should not use ''edge'' as their main day-to-day workstation or as a productive system. Because ''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.
{{cmd|apk add application@personal}}


However, testing ''edge'' is a very valuable activity which helps the Alpine Linux development to ensure that the quality of the stable releases is high. Testing ''edge'' is a great way to contribute to the Alpine Linux development.
apk will by default only use the untagged repositories, but adding a package with a @tag:


== Upgrading to edge ==
1. will prefer the repository with that tag for the named package, even if a later version of the package is available in another repository


{{:Include:Upgrading to Edge}}
2. ''allows'' pulling in dependencies for the tagged package from the tagged repository (though it ''prefers'' to use untagged repositories to satisfy dependencies if possible)


== Testing ==
=== Upgrading to edge ===


The '''testing''' repository was introduced with Alpine Linux ''edge'' development. 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).
{{:Include:Upgrading to Edge}}


Before a package can move from ''testing'' to ''main'' or ''community'', the following requirements must be met:
=== Using testing repository===


# Package must work correctly, including the init.d script (if provided) and default configuration.
Installing packages from '''testing''' repository with '''main''' and '''community''' repositories in the '''edge''' branch and submitting '''[https://gitlab.alpinelinux.org/alpine/aports/issues bug reports]''' is one of the best ways to [[Contribute|contribute]] to Alpine Linux.
# Packaging must be done correctly, with files installed in the right places, e.g. configs are in <code>/etc/</code> and not in <code>/usr/etc</code>.
# 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 <code>depend=so:libsqlite3.so.0</code> and the user should not have to manually add a <code>depend="sqlite-libs"</code> 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.


=== Enabling the testing repository ===
However installing packages from '''testing''' repository of '''edge''' branch with '''main''' or '''community''' repositories in the '''release branch''' is not guaranteed to work.


To enable the repository, edit the file <code>/etc/apk/repositories</code> and add (or uncomment) a line that points to the "testing" directory.
The method explained below is one way to handle this scenario.  Do this only if you need package(s) which are available only in '''testing''' repository.


Its format is:
{{Warning|'''Only do this if you're 100% sure what you're doing! and you really need it'''  Alpine does not officially support mixing branches this way.}}


<code><nowiki>https://<mirror-server>/alpine/edge/testing</nowiki></code>
Edit the file {{path|/etc/apk/repositories}} and add (or uncomment) a line that points to the "testing" directory, while also [[#Repository_pinning|tagging]] the repository, for example:


After enabling the testing repository, one needs to update the index of available packages with:
{{Cat|/etc/apk/repositories|
{{Cmd|# apk update}}
https://dl-cdn.alpinelinux.org/alpine/v{{#expr:{{AlpineLatest}}}}/main
And then it's possible to install packages from the testing repository.
https://dl-cdn.alpinelinux.org/alpine/v{{#expr:{{AlpineLatest}}}}/community
@testing https://dl-cdn.alpinelinux.org/alpine/edge/testing
}}


== Unmaintained ==
In that case, the tag is <code>@testing</code>, which allows you to pull packages from that repository without potentially messing up your install (too badly):


{{Expand|Maybe also move this somewhere else?}}
{{Tip|Check [[ Alpine_Package_Keeper#Check_Dependencies|package dependencies]] for the package in question, before installing it from the tagged repository.}}


'''unmaintained''' packages are not built.
{{cmd|# apk add wireguard-go@testing}}


= See also =
= See also =


* [[Alpine Linux in a chroot]]
* [[Alpine Linux in a chroot]]
* [http://bugs.alpinelinux.org/ Report Bugs]
* [https://bugs.alpinelinux.org/ Report Bugs]


[[Category:Development]]
[[Category:Development]]
[[Category:Package Manager]]
[[Category:Package Manager]]

Latest revision as of 12:11, 19 September 2024

Repositories

There are three package repositories in Alpine Linux:

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. . Packages from testing that are accepted go to the community repository or (rarely) 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:

  1. Package must work correctly, including the init.d script (if provided) and default configuration.
  2. Packaging must be done correctly, with files installed in the right places, e.g. configs are in /etc/ and not in /usr/etc.
  3. 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 a depend="sqlite-libs" in the APKBUILD.
  4. 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 release branch from edge. The current release branch of Alpine Linux is 3.2.

The main repository of every release branch is typically supported for 2 years. The community repository of any release branch is supported until next stable release i.e six months. Security fixes beyond that can be made on request when there are patches available.

Note: If packages from community repository are used, one needs to update to the latest release branch to continue to have support.

To upgrade to the latest release branch, follow the steps in Upgrading Alpine Linux.

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. This version contains the latest build of all available Alpine Linux packages. Those packages are updated on a regular basis.


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.


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. However, testing edge is a very valuable activity which helps the Alpine Linux development to ensure that the quality of the stable releases is high. Testing edge is a great way to contribute to the Alpine Linux development.

Similar to release branches edge consists of main and community repositories in addition to the third repository i.e testing.

Managing repositories

The package repositories that apk uses to retrieve package files for installation are specified in file /etc/apk/repositories. To automatically configure the repositories file /etc/apk/repositories, use the setup-apkrepos script:

# setup-apkrepos -cf

After making changes to /etc/apk/repositories you should update the package index using:

# apk update

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. A tagged repository is prefixed with the @tag specifier, followed by a space and the repository location.

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

/media/sda1/apks/

In a properly configured Alpine Linux system, the default will look something like:

Contents of /etc/apk/repositories

#/media/cdrom/apks http://dl-cdn.alpinelinux.org/alpine/v3.2/main http://dl-cdn.alpinelinux.org/alpine/v3.2/community
Note: For better security you should probably change the url's from http to https. Some Alpine Linux package mirrors may not support https. If that is the case, you will need to change mirrors or revert back. You can check if your mirror supports https on https://mirrors.alpinelinux.org

Repository pinning

You can specify additional "tagged" repositories in /etc/apk/repositories:

Contents of /etc/apk/repositories

https://dl-cdn.alpinelinux.org/alpine/v3.18/main https://dl-cdn.alpinelinux.org/alpine/v3.18/community @personal https:/personal-repo.example.com/alpine-apks/

After which you can "pin" dependencies to these tags using:

apk add application@personal

apk will by default only use the untagged repositories, but adding a package with a @tag:

1. will prefer the repository with that tag for the named package, even if a later version of the package is available in another repository

2. allows pulling in dependencies for the tagged package from the tagged repository (though it prefers to use untagged repositories to satisfy dependencies if possible)

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.2 or latest-stable) therein need to be pointing to edge.

When using edge branch, testing repository can be added if the packages that one needs are available only in testing repository.

Note: Remember that, packages in testing repository have no support.


Contents of /etc/apk/repositories

#/media/cdrom/apks http://dl-cdn.alpinelinux.org/alpine/edge/main http://dl-cdn.alpinelinux.org/alpine/edge/community http://dl-cdn.alpinelinux.org/alpine/edge/testing

After upgrading to edge, the currently installed edge version may be checked with

$ cat /etc/alpine-release

and referring to the build date that is attached to the release.

Warning: Do not enable stable and edge repos 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

Installing packages from testing repository with main and community repositories in the edge branch and submitting bug reports is one of the best ways to contribute to Alpine Linux.

However installing packages from testing repository of edge branch with main or community repositories in the release branch is not guaranteed to work.

The method explained below is one way to handle this scenario. Do this only if you need package(s) which are available only in testing repository.

Warning: Only do this if you're 100% sure what you're doing! and you really need it Alpine does not officially support mixing branches this way.


Edit the file /etc/apk/repositories and add (or uncomment) a line that points to the "testing" directory, while also tagging the repository, for example:

Contents of /etc/apk/repositories

https://dl-cdn.alpinelinux.org/alpine/v3.2/main https://dl-cdn.alpinelinux.org/alpine/v3.2/community @testing https://dl-cdn.alpinelinux.org/alpine/edge/testing

In that case, the tag is @testing, which allows you to pull packages from that repository without potentially messing up your install (too badly):

Tip: Check package dependencies for the package in question, before installing it from the tagged repository.

# apk add wireguard-go@testing

See also