M BUZZ CRAZE NEWS
// news

How to install .apk on Alpine Linux like .deb in Debian using dpkg

By John Parsons

My question is in the title. Problem:

Comparison with other distros doesn't speak about installing a local .deb in Debian or whatever is Gentoo's equivalent or Alpine Linux's .apk. Plus the command apk add complains about unsatisfiable dependencies for the world when I want it to install from .apk file downloaded, and it doesn't tell what's wrong, just:

world: <package_name> <package_name>

Simple more-or-less obvious searches such as how to install apk on alpine linux returns something weird or Android stuff, making Alpine Linux look like it doesn't exist in the first place -or- doesn't support installing a downloaded package like you can do in Debian with dpkg.

3 Answers

Let's say you are trying to install glibc in Alpine

Download the packages into your current directory

wget ""
wget ""

Then, use apk with --allow-untrusted flag

apk add --allow-untrusted glibc-2.21-r2.apk glibc-bin-2.21-r2.apk

And finish the installation (only needed in this example)

/usr/glibc/usr/bin/ldconfig /lib /usr/glibc/usr/lib
1

Generally, prebuilt packages are preferrable, but if you want or don't mind building from source, you can do it this way:

a.sh:

apk add alpine-sdk sudo
abuild-keygen -ain
git clone --branch v3.15.4 --single-branch --depth 1
cd aports/main/musl
abuild -rF
apk add /root/packages/main/x86_64/musl-1.2.2-r7.apk
$ docker run --rm -itv $PWD:/host alpine:3.15 sh -eux host/a.sh

If you're doing it on the host OS, you generally don't want to build under root. In which case you don't need to pass -F to abuild.

For further details you can refer to this page.

Look at the AlpineLinux Wiki page on Alpine Linux package management?

Verbatim from there,

Because Alpine Linux is designed to run from RAM, package management involves two phases:

  1. Installing / Upgrading / Deleting packages on a running system
  2. Restoring a system to a previously configured state (e.g. after reboot), including all previously installed packages and locally modified configuration files. (RAM-Based Installs Only)

apk is the tool used to install, upgrade, or delete software on a running sytem.
lbu is the tool used to capture the data necessary to restore a system to a previously configured state.

This page documents the apk tool - See the Alpine Local Backup page for the lbu tool.

1

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy