Alpine Package Keeper
Alpine package management
Alpine has the following tools for package management:
- apk_add
- apk_create
- apk_delete
- apk_fetch
- apk_get
- apk_glob
- apk_info
- apk_version
All of these commands have a -h option, which will give you the different options they support.
Adding packages
Use apk_add to install packages. The following options are supported:
usage: apk_add [-dfhInoqsuv] [-r reqby] apkname ...
-d Don't install dependencies. -f Force installation. -h Show help and exit. -I Don't execute any install script. -n Don't actually install a package, just report the steps that would be taken if it was. -q Quiet mode. -r Register package as a dependency for reqby. -s Ignore checksums. -u Update if older version of package is installed. -v Turn on verbose output.
If you want to install openssh for example, you run:
apk_add openssh
apk_add supports installation from cdrom, usb, http, ftp, ssh (scp) and rsync. scp is only available if openssh or dropbear is installed and rsync is only available if rsync is installed.
Dry-run
Sometimes you would like to see what would get installed if you install a package, or what dependencies would be pulled in by the package. You can see this using:
apk_add -n openssh
Removing packages
Removing packages is done using:
% apk_delete openssh
To remove a package plus it's dependencies, use:
% apk_delete -R openssh
Even more dangerous is:
% apk_delete -r openssl
which will delete openssl plus all packages that depend on it.
Since removing packages (recursively) can seriously damage your system, it is best to use:
% apk_delete -n openssh
Which will not really remove the package, but just show what it would do.
Looking for packages?
To see the packages available in the repository, use:
% apk_fetch -l
Or you might use:
% apk_fetch -l -v
Which will also show the version number of the available packages.
If the text scrolls by too fast you can use:
% apk_fetch -l | less
Info about your packages
There are several other commands that give more information about the packages installed on your system.
To see the contents of a certain package, use:
% apk_info -L openssh
To see the size of a package, use:
% apk_info -s openssh
To see all packages that depend on a package, eg zlib:
% apk_glob -r zlib
To find out to what package a certain file or directory belongs to, eg /etc/shorewall:
% apk_info -W /etc/shorewall
Upgrading alpine
The easiest way to upgrade alpine is to safe your settings to floppy or usb-key and reboot using a new CD. But there are several other possibilities a well:
- Change the CD, but do not reboot
- Update over network
Changing the CD, no reboot
First update the package list:
% apk_fetch -u
Check what packages have changed version numbers
% apk_version -v
Next:
% apk_version -v -l '<'
Will show you what packages needs to be updated
The first thing to check is whether the apk-tools need to be upgraded, if so, always do this first:
% apk_add -u apk-tools
Now it is time to upgrade the other packages:
% apk_version -q -l '<' | xargs apk_add -u
After your upgrade you might find some apk-new files in /etc,these are upgraded config files. A simple utility to go over these files is:
% update-conf -l
Update over network
This is about the same as the previous entry. The key-difference is that we will change the install-source for apk. This can be done in two ways, on the command-line, using export or changing an /etc file:
% export APK_PATH=http://dev.alpinelinux.org/alpine/v1.4/apks/
or edit apk.conf, and add your requested resource.
% vi /etc/apk.conf
You can use sources from:
- cdrom
- http(s)
- ftp
- rsync (remember that rsync has to be installed before you can use this! (% apk_add rsync))
After you made this change, continue as the cd-rom upgrade with, etc
% apk_fetch -u