84

If I'm using Alpine 3.8, how can I add a specific package from the Alpine Edge repository? Is this even supported? There is no equivalent of backports, from what I can see.

I want to add the new version of this: https://pkgs.alpinelinux.org/package/edge/community/armhf/librdkafka

And not the older version in the 3.8 repo: https://pkgs.alpinelinux.org/package/v3.8/community/s390x/librdkafka

1
  • 1
    To update valiano's answer, the Alpine Edge repository url should now be --repository=https://dl-cdn.alpinelinux.org/alpine/edge/community
    – VRS
    Jul 24, 2022 at 19:36

3 Answers 3

123

You could specify the exact repo to apk, using the --repository parameter.
In your case:

apk add librdkafka --repository=https://dl-cdn.alpinelinux.org/alpine/edge/community
5
  • 2
    I needed to use --repository=http://dl-cdn.alpinelinux.org/alpine/edge/main (without the x86_64, because apk seems to add that itself). Nov 30, 2018 at 23:08
  • 17
    For installing the newest librdfkafka (currently 1.0.1) from edge use community --repository=http://dl-cdn.alpinelinux.org/alpine/edge/community instead
    – Jurrian
    May 29, 2019 at 16:52
  • Thanks! I was able to install skopeo in the recent version 1.0.0 (r1) with you help and this line: apk add skopeo --repository=http://dl-cdn.alpinelinux.org/alpine/edge/community
    – Jens Vagts
    Jun 10, 2020 at 14:49
  • For packages found/shown under pkgs.alpinelinux.org/package/edge/testing/x86_64, what worked for me was apk add package-name --repository=https://dl-cdn.alpinelinux.org/alpine/edge/testing
    – xpt
    Jun 22 at 4:14
  • If you have /etc/apk/repositories file, and there are different repos listed on top, even if you add the --repository flag for apk add, the repos in the /etc file will overwrite your preference. I removed the already existing locations, added the repo version I needed and it worked. Jun 28 at 11:32
42

You can also add the repo:

echo "@testing https://dl-cdn.alpinelinux.org/alpine/edge/testing" >> /etc/apk/repositories

and reference it with apk via @testing. Example:

apk add package-name@testing
1
  • Excellent, please consider replacing http:// by https://
    – 8ctopus
    May 17, 2022 at 4:18
4

Edge repository may be enabled permanently. Just do the following:

sed -i '/edge/s/^#//' /etc/apk/repositories
1
  • 2
    Your sed command assumes the edge repositories are already included in the file which is not the case in alpine 3.15. An updated command that replaces the repositories to edge is sed -i 's|v3\.\d*|edge|' /etc/apk/repositories
    – 8ctopus
    May 17, 2022 at 10:39

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.