This machine's repository
A package manager installs from the repositories listed in its configuration. On a normal machine these point at servers on the internet; this browser machine has no network, so it uses a small local copy baked into the image. Everything in this module works offline against it:
cat /etc/apk/repositoriesIn the terminal
student@vulntech:~$ cat /etc/apk/repositories # This machine has no internet connection. Instead of the online Alpine # repositories (https://dl-cdn.alpinelinux.org/alpine/v3.21/main), it # installs packages from a small local copy: /srv/packages/main
apk update refreshes the manager's list of what's available. Run it once before searching or installing:
apk updateIn the terminal
student@vulntech:~$ apk update ERROR: Unable to lock database: Permission denied ERROR: Failed to open apk database: Permission denied
Searching
apk search finds packages whose name matches a word. Add -v to see a one-line description of each match:
apk search jq
apk search -v htopIn the terminal
student@vulntech:~$ apk search jq jq-1.7.1-r0 jq-doc-1.7.1-r0 student@vulntech:~$ apk search -v htop htop-3.3.0-r0 - Interactive process viewer htop-doc-3.3.0-r0 - Interactive process viewer (documentation)
Reading about a package
apk info NAME describes a package: what it's for, its homepage and its size. This works whether or not the package is installed, because it reads the repository's catalogue. -d shows just the description:
apk info htop
apk info -d jqIn the terminal
student@vulntech:~$ apk info htop htop-3.3.0-r0 description: Interactive process viewer htop-3.3.0-r0 webpage: https://htop.dev/ htop-3.3.0-r0 installed size: 272 KiB student@vulntech:~$ apk info -d jq jq-1.7.1-r0 description: A lightweight and flexible command-line JSON processor
What does it depend on?
-R (requires) lists a package's dependencies, the other packages it needs. jq needs a library for working with text patterns, for example:
apk info -R jqIn the terminal
student@vulntech:~$ apk info -R jq jq-1.7.1-r0 depends on: so:libc.musl-x86.so.1 so:libonig.so.5
Tip: One thing is different from Ubuntu's
apt show:apk info -L, which lists the files a package installs, only works once the package is installed. You'll use it in the next lessons.
Remember:
apk updaterefreshes the list.apk search wordfinds packages,apk info NAMEdescribes one,-dits description,-Rits dependencies.