81

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

lospejos
  • 1,976
  • 3
  • 19
  • 35
clay
  • 18,138
  • 28
  • 107
  • 192
  • 1
    To update [valiano's answer](https://stackoverflow.com/a/52903112/10393488), the Alpine Edge repository url should now be `--repository=https://dl-cdn.alpinelinux.org/alpine/edge/community` – VRS Jul 24 '22 at 19:36

3 Answers3

120

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
Marin Bînzari
  • 5,208
  • 2
  • 26
  • 43
valiano
  • 16,433
  • 7
  • 64
  • 79
  • 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). – Bardi Harborow Nov 30 '18 at 23:08
  • 16
    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 '19 at 16:52
  • Thanks! I was able to install [skopeo](https://github.com/containers/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 '20 at 14:49
  • For packages found/shown under https://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 '23 at 04: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. – Barna Burom Jun 28 '23 at 11:32
41

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
carlin.scott
  • 6,214
  • 3
  • 30
  • 35
BorisS
  • 686
  • 5
  • 9
4

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

sed -i '/edge/s/^#//' /etc/apk/repositories
  • 1
    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 '22 at 10:39