aboutsummaryrefslogtreecommitdiffstats
path: root/modules/Working/pages/apk.adoc
diff options
context:
space:
mode:
Diffstat (limited to 'modules/Working/pages/apk.adoc')
-rw-r--r--modules/Working/pages/apk.adoc28
1 files changed, 8 insertions, 20 deletions
diff --git a/modules/Working/pages/apk.adoc b/modules/Working/pages/apk.adoc
index 67cd450..f77c470 100644
--- a/modules/Working/pages/apk.adoc
+++ b/modules/Working/pages/apk.adoc
@@ -1,15 +1,13 @@
-= Working with the Alpine Package Keeper (`apk`)
// MAINT: apk-tools - whole page
+= Working with the Alpine Package Keeper (`apk`)
`apk` is the Alpine Package Keeper - the distribution's package manager.
It is used to manage the packages (software and otherwise) of the system.
It is the primary method for installing additional software, and is available in the `apk-tools` package.
== Normal Usage
-
-=== Repositories and Mirrors
// MAINT: repositories and versions
-
+=== Repositories and Mirrors
`apk` fetches information about available packages, as well as the packages themselves from various mirrors, which contain various repositories.
Sometimes, those terms are used interchangeably.
Here is a summary of relevant definitions:
@@ -54,9 +52,8 @@ NOTE: This example uses the `http://` protocol. `ftp://` and `https://` protocol
// TODO: xref to installation part that's relevant
NOTE: This file should already have been been partially populated when you installed alpine.
-=== Searching for Packages
// MAINT: apk-search and pkgs.alpinelinux.org
-
+=== Searching for Packages
In order to know what package to install, one must be able to find packages.
Alpine has a specialized https://pkgs.alpinelinux.org[web interface] dedicated to looking through various available packages.
However, `apk` also provides a built-in searching mechanism.
@@ -78,9 +75,8 @@ apk search -e so:libsqlite3.so.* <4>
<3> You can exclude partial matches using `-e`.
<4> You can specify that what you're searching for is a library using the `so:` prefix (or the `cmd:` prefix for commands, and `pc:` prefix for pkg-config files) - it will work with `-e` (in fact, the prefix is required for this use-case if `-e` is used).
-=== Installing Packages
// MAINT: apk-add
-
+=== Installing Packages
Once you know what package you want to install, you must know how to do that.
Apk's `add` command is more strict than the `search` command - wildcards are not available, for instance.
// TODO: gotchas, already asked in #a-docs
@@ -117,9 +113,8 @@ apk add pc:msgpack <5>
NOTE: If `apk add` finds multiple matching packages (for example multiple `cmd:` matches), it will select the one with the highest version number.
-=== Upgrading Packages
// MAINT: apk-update, apk-upgrade
-
+=== Upgrading Packages
Updating the system using apk is very simple.
One need only run `apk upgrade`.
Technically, this is two steps: `apk update`, followed by `apk upgrade` proper.
@@ -134,9 +129,8 @@ Simply invoking it normally with present you with the difference between the two
NOTE: `apk update` is only ran once your cache is invalidated, which by default happens every 4 hours.
-=== Querying Package Information
// MAINT: apk-info
-
+=== Querying Package Information
In some cases, it may be useful to inspect packages or files to see various details.
For this use, the `info` subcommand exists.
It may be used on any package, installed or not, though the information on the latter will be more limited.
@@ -146,9 +140,8 @@ By default, `info` will list the package description, webpage and installed size
// MAINT: apk-info: `apk info -h` output
For more details (such as a list of flags the subcommand supports), you can use the `apk info -h` output's "Info options" section or see the manual page.
-=== Removing Packages
// MAINT: apk-del
-
+=== Removing Packages
Often, it is desirable to remove a package.
This can be done using the `del` subcommand, with a base syntax that is identical to the `add` subcommand.
@@ -159,7 +152,6 @@ NOTE: Removing a package will automatically remove all of its dependencies that
The `del` subcommand also supports the `-r` flag, which will remove all packages that depend on the package being removed as well, rather than error out due to the package being needed.
=== Cleanup
-
Many package managers have specific features to "clean up".
A common one is `apt`, which has an `autoremove` subcommand.
Apk does this by default when removing packages.
@@ -168,18 +160,15 @@ It is also possible to clear out the apk cache, assuming it is enabled.
You can do this using `apk cache clean`.
== Advanced Usage
-
=== World
-
The packages you want to have explicitly installed are listed in the "world file", available in `/etc/apk/world`.
It is safe to edit it by hand.
If you've edited it by hand, you may run `apk add` with no arguments to bring the package selection to a consistent state.
NOTE: Virtuals like `cmd:`, `so:` and `pc:` will appear as such in your world file - this is why using `so:` is discouraged - the soname might get bumped!
-=== Virtuals
// MAINT: apk-add -t
-
+=== Virtuals
While `cmd:`, `so:` and `pc:` packages are automatically created virtuals, you can create your own as well.
These allow for quick removal of purpose-specific packages.
See the following examples for details:
@@ -194,7 +183,6 @@ apk add a b c --virtual abc <3>
<3> This is equivalent to the first example.
=== Swapping Repositories
-
When alpine has a new release, the repository path will change.
Assuming you are going forward in time (e.g from `3.8` to `3.9`), you can simply edit `/etc/apk/repositories` and run `apk upgrade --available`.