https://wiki.alpinelinux.org/w/api.php?action=feedcontributions&user=Yoonghm&feedformat=atomAlpine Linux - User contributions [en]2024-03-29T01:09:35ZUser contributionsMediaWiki 1.40.0https://wiki.alpinelinux.org/w/index.php?title=Alpine_Package_Keeper&diff=16450Alpine Package Keeper2019-09-21T13:13:36Z<p>Yoonghm: /* Overview */</p>
<hr />
<div><!--For searching: apk, APK--><br />
<br />
Because Alpine Linux is designed to run from RAM, package management involves two phases:<br />
* Installing / Upgrading / Deleting packages on a running system.<br />
* 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)'''<br />
<br /><br />
'''apk''' is the tool used to install, upgrade, or delete software on a running system.<br /><br />
'''lbu''' is the tool used to capture the data necessary to restore a system to a previously configured state.<br />
<br />
This page documents the [https://git.alpinelinux.org/apk-tools/ apk tool] - See the [[Alpine_local_backup|Alpine Local Backup page]] for the lbu tool.<br />
<br />
= Overview =<br />
<br />
The '''apk''' tool has the following applets:<br />
<br />
{|<br />
| [[#Add a Package|add]] <br />
| Add new packages or upgrade packages to the running system<br />
|-<br />
| [[#Remove a Package|del]]<br />
| Delete packages from the running system<br />
|-<br />
| fix <br />
| Attempt to repair or upgrade an installed package <br />
|-<br />
| [[#Update the Package list|update]] <br />
| Update the index of available packages<br />
|-<br />
| [[#Info on Packages|info]]<br />
| Prints information about installed or available packages<br />
|-<br />
| [[#Search for Packages|search]] <br />
| Search for packages or descriptions with wildcard patterns<br />
|-<br />
| [[#Upgrade a Running System|upgrade]]<br />
| Upgrade the currently installed packages<br />
|-<br />
| [[#Cache Maintenance|cache]]<br />
| Maintenance operations for locally cached package repository<br />
|-<br />
| version <br />
| Compare version differences between installed and available packages<br />
|-<br />
| index <br />
| create a repository index from a list of packages<br />
|-<br />
| fetch <br />
| download (but not install) packages<br />
|-<br />
| audit <br />
| List changes to the file system from pristine package install state<br />
|-<br />
| verify <br />
| Verify a package signature<br />
|- <br />
| dot<br />
| Create a [http://graphviz.org/ graphviz] graph description for a given package<br />
|- <br />
| [[#apk_policy|policy]]<br />
| Display the repository that updates a given package, plus repositories that also offer the package<br />
|- <br />
| stats <br />
| Display statistics, including number of packages installed and available, number of directories and files, etc.<br />
|- <br />
| manifest<br />
| Display checksums for files contained in a given package<br />
|}<br />
<br />
= Packages and Repositories =<br />
<br />
Software packages for Alpine Linux are digitally signed tar.gz archives containing programs, configuration files, and dependency metadata. They have the extension <code>.apk</code>, and are often called "a-packs".<br />
<br />
The packages are stored in one or more ''repositories''. A repository is simply a directory with a collection of *.apk files. The directory must include a special index file, named {{Path|APKINDEX.tar.gz}} to be considered a repository.<br />
<br />
The '''apk''' utility can install packages from multiple repositories. The list of repositories to check is stored in {{Path|/etc/apk/repositories}}, one repository per line. If you booted from a USB stick ({{Path|/media/sda1}}) or CD-ROM ({{Path|/media/cdrom}}), your repository file probably looks something like this:<br />
<br />
{{Cat|/etc/apk/repositories|/media/sda1/apks/}}<br />
<br />
In addition to local repositories, the '''apk''' utility uses '''busybox wget''' to fetch packages using ''http:'', ''https:'' or ''ftp:'' protocols. The following is a valid repository file:<br />
<br />
{{Cat|/etc/apk/repositories|<br />
/media/sda1/apks<br />
http://dl-3.alpinelinux.org/alpine/v2.6/main<br />
https://dl-3.alpinelinux.org/alpine/v2.6/main<br />
ftp://dl-3.alpinelinux.org/alpine/v2.6/main<br />
}}<br />
<br />
{{Note| A list of public repositories is in [https://git.alpinelinux.org/cgit/aports/tree/main/alpine-mirrors/mirrors.yaml mirrors.yaml] in the alpine-mirrors git repository. Accepted protocols vary.}}<br />
<br />
== Repository pinning ==<br />
<br />
You can specify additional "tagged" repositories in {{Path|/etc/apk/repositories}}:<br />
<br />
{{Cat|/etc/apk/repositories|<br />
http://nl.alpinelinux.org/alpine/v3.7/main<br />
http://nl.alpinelinux.org/alpine/v3.7/community<br />
@edge http://nl.alpinelinux.org/alpine/edge/main<br />
@edgecommunity http://nl.alpinelinux.org/alpine/edge/community<br />
@testing http://nl.alpinelinux.org/alpine/edge/testing<br />
}}<br />
<br />
After which you can "pin" dependencies to these tags using:<br />
<br />
{{cmd|apk add stableapp newapp@edge bleedingapp@testing}}<br />
<br />
Apk will now by default only use the untagged repositories, but adding a tag to specific package:<br />
<br />
1. will prefer the repository with that tag for the named package, even if a later version of the package is available in another repository<br />
<br />
2. ''allows'' pulling in dependencies for the tagged package from the tagged repository (though it ''prefers'' to use untagged repositories to satisfy dependencies if possible)<br />
<br />
== Commandline repository options ==<br />
<br />
By default, the '''apk''' utility will use the system repositories for all operations. This behavior can be overridden by the following options:<br />
<br />
{|<br />
| --repositories-file REPOFILE<br />
| Override the system repositories by specifying a repositories file.<br />
|-<br />
| <nowiki>-X|--repository REPO</nowiki><br />
| Specify a supplemental repository that will be used in addition to the system repositories. This option can be provided multiple times.<br />
|}<br />
<br />
= Update the Package list =<br />
<br />
Remote repositories change as packages are added and upgraded. To get the latest list of available packages, use the ''update'' command. The command downloads the {{Path|APKINDEX.tar.gz}} from each repository and stores it in the local cache, typically {{Path|/var/cache/apk/}}, {{Path|/var/lib/apk/}} or {{Path|/etc/apk/cache/}}.<br />
<br />
{{Cmd|apk update}}<br />
<br />
<!--<br />
fetch http://dl-3.alpinelinux.org/alpine/v2.1/main/APKINDEX.tar.gz<br />
--><br />
<br />
{{Tip|If using remote repositories, it is a good idea to do an '''update''' just before doing an '''add''' or '''upgrade''' command. That way you know you are using the latest software available.}}<br />
<br />
= Add a Package =<br />
<br />
Use '''add''' to install packages from a repository. Any necessary dependencies are also installed. If you have multiple repositories, the '''add''' command installs the newest package.<br />
<br />
{{Cmd|apk add openssh<br />
apk add openssh openntp vim}}<br />
<br />
If you only have the main repository enabled in your configuration, apk will not include packages from the other repositories. To install a package from the edge/testing repository without changing your repository configuration file, use the command below. This will tell apk to use that particular repository.<br />
<br />
{{cmd|apk add cherokee --update-cache --repository http://dl-3.alpinelinux.org/alpine/edge/testing/ --allow-untrusted}}<br />
<br />
{{Note|Be careful when using third-party or the testing repository. Your system can go down.}}<br />
<br />
= Add a local Package =<br />
<br />
To install a locally available apk package, for example if this device has no internet access but you can upload apk packages directly to it, use the '''--allow-untrusted''' flag:<br />
<br />
{{cmd|apk add --allow-untrusted /path/to/file.apk}}<br />
<br />
Note that multiple packages can be given. When installing a local package, all dependencies should also be specified. For example:<br />
<br />
{{cmd|apk add --allow-untrusted /var/tig-2.2-r0.apk /var/git-2.11.1-20.apk}}<br />
<br />
= Remove a Package =<br />
Use '''del''' to remove a package (and dependencies that are no longer needed.) <br />
<br />
{{cmd|apk del openssh<br />
apk del openssh openntp vim}}<br />
<br />
= Upgrade a Running System =<br />
<br />
To upgrade ''all'' the packages of a running system, use '''upgrade''':<br />
<br />
{{cmd|apk update<br />
apk upgrade<br />
}}<br />
<br />
For example, the procedure on a system that has various [https://wiki.alpinelinux.org/wiki/Alpine_Linux_package_management#Repository_pinning repositories pinned] might display as follows:<br />
<br />
# apk update<br />
fetch http://dl-3.alpinelinux.org/alpine/v3.6/main/x86_64/APKINDEX.tar.gz<br />
fetch http://dl-3.alpinelinux.org/alpine/v3.6/community/x86_64/APKINDEX.tar.gz<br />
fetch http://dl-3.alpinelinux.org/alpine/edge/main/x86_64/APKINDEX.tar.gz<br />
fetch http://dl-3.alpinelinux.org/alpine/edge/community/x86_64/APKINDEX.tar.gz<br />
fetch http://dl-3.alpinelinux.org/alpine/edge/testing/x86_64/APKINDEX.tar.gz<br />
v3.6.2-191-gf98d79930f [http://dl-3.alpinelinux.org/alpine/v3.6/main]<br />
v3.6.2-190-ga5d68c47df [http://dl-3.alpinelinux.org/alpine/v3.6/community]<br />
v3.6.0-4618-g0bf77c9821 [http://dl-3.alpinelinux.org/alpine/edge/main]<br />
v3.6.0-4605-g85ed51dd83 [http://dl-3.alpinelinux.org/alpine/edge/community]<br />
v3.6.0-4624-g11f1b9c8ab [http://dl-3.alpinelinux.org/alpine/edge/testing]<br />
OK: 20118 distinct packages available<br />
<br />
# apk upgrade<br />
(1/2) Upgrading extra-cmake-modules@testing (5.38.0-r0 -> 5.39.0-r0)<br />
(2/2) Upgrading extra-cmake-modules-doc@testing (5.38.0-r0 -> 5.39.0-r0)<br />
Executing mdocml-apropos-1.14.1-r0.trigger<br />
OK: 2635 MiB in 803 packages<br />
<br />
To upgrade ''only a few'' packages, use the '''add''' command with the ''-u'' or ''--upgrade'' option:<br />
<br />
{{cmd|apk update<br />
apk add --upgrade busybox <br />
}}<br />
<br />
{{Note|Remember that when you reboot your machine, the remote repository will not be available until after networking is started. This means packages newer than your local boot media will likely not be installed after a reboot. To make an "upgrade" persist over a reboot, use a [[#Local Cache|local cache]].}}<br />
<br />
= Search for Packages =<br />
The '''search''' command searches the repository Index files for installable packages. <br />
<br />
The return format is '''Package'''-'''Version'''. Omit '''Version''' for ''apk add '''Package'''''<br />
<br />
Examples:<br />
* To list all packages available, along with their descriptions: {{cmd|apk search -v}}<br />
* To list all packages are part of the ACF system: {{cmd|apk search -v 'acf*' }}<br />
* To list all packages that list NTP as part of their description, use the ''-d'' or ''--description'' option: {{cmd|apk search -v --description 'NTP' }}<br />
<br />
= Information on Packages =<br />
<br />
== apk info ==<br />
<br />
The '''info''' command provides information on the contents of packages, their dependencies, and which files belong to a package.<br />
<br />
For a given package, each element can be chosen (for example, ''-w'' to show just the webpage information), or all information displayed with the ''-a'' command.<br />
<br />
Example: {{cmd|apk info -a zlib}}<br />
<br />
'''zlib-1.2.5-r1 description:'''<br />
A compression/decompression Library<br />
<br />
'''zlib-1.2.5-r1 webpage:'''<br />
<nowiki>http://zlib.net</nowiki><br />
<br />
'''zlib-1.2.5-r1 installed size:'''<br />
94208<br />
<br />
'''zlib-1.2.5-r1 depends on:'''<br />
libc0.9.32<br />
<br />
'''zlib-1.2.5-r1 is required by:'''<br />
libcrypto1.0-1.0.0-r0<br />
apk-tools-2.0.2-r4<br />
openssh-client-5.4_p1-r2<br />
openssh-5.4_p1-r2<br />
libssl1.0-1.0.0-r0<br />
freeswitch-1.0.6-r6<br />
atop-1.25-r0 <br />
<br />
'''zlib-1.2.5-r1 contains:'''<br />
lib/libz.so.1.2.5<br />
lib/libz.so.1<br />
lib/libz.so <br />
<br />
'''zlib-1.2.5-r1 triggers:'''<br />
<br />
As shown in the example you can determine<br />
* The '''description''' of the package (''-d'' or ''--description'')<br />
* The '''webpage''' where the application is hosted (''-w'' or ''--webpage'')<br />
* The '''size''' the package will require once installed (in bytes) (''-s'' or ''--size'')<br />
* What packages are required to use this one ('''depends''') (''-R'' or ''--depends'')<br />
* What packages require this one to be installed ('''required by''') (''-r'' or ''--rdepends'')<br />
* The '''contents''' of the package, that is, which files it installs (''-L'' or ''--contents'')<br />
* Any '''triggers''' this package sets. (''-t'' or ''--triggers'') Listed here are directories that are watched; if a change happens to the directory, then the trigger script is run at the end of the apk add/delete. For example, doing a depmod once after installing all packages that add kernel modules.<br />
<br />
{{Tip|The '''info''' command is also useful to determine which package a file belongs to. For example: {{cmd|apk info --who-owns /sbin/lbu}} will display<br />
<br />
/sbin/lbu is owned by alpine-conf-x.x-rx<br />
}}<br />
<br />
=== Listing installed packages ===<br />
<br />
To list all installed packages, use:<br />
<br />
<pre>apk info</pre><br />
<br />
To list all installed packages in alphabetical order, with a description of each, do:<br />
<br />
<pre>apk -vv info|sort</pre><br />
<br />
== apk policy ==<br />
<br />
To display the repository a package was installed from and will be updated from, plus any [https://wiki.alpinelinux.org/wiki/Alpine_Linux_package_management#Repository_pinning tagged] or enabled repositories where it is also offered, if any, for this architecture - its '''policy''':<br />
<br />
apk policy ''package''<br />
<br />
For example:<br />
<pre><br />
$ apk policy vlc<br />
vlc policy:<br />
2.2.6-r1:<br />
lib/apk/db/installed<br />
http://dl-3.alpinelinux.org/alpine/v3.7/community<br />
3.0.0_rc2-r1:<br />
@edgecommunity http://dl-3.alpinelinux.org/alpine/edge/community<br />
</pre><br />
<br />
= Additional apk Commands =<br />
In progress...<br />
<br />
= Local Cache =<br />
<br />
{{:Local_APK_cache}}<br />
<br />
= Advanced APK Usage =<br />
<br />
== Holding a specific package back ==<br />
<br />
In certain cases, you may want to upgrade a system, but keep a specific package at a back level. It is possible to add "sticky" or versioned dependencies. For instance, to hold the ''asterisk'' package to the 1.6.2 level or lower:<br />
{{cmd|1=apk add asterisk=1.6.0.21-r0}}<br />
or<br />
{{cmd|apk add 'asterisk<1.6.1'}}<br />
<br />
after which a {{cmd|apk upgrade}}<br />
<br />
will upgrade the entire system, keeping the asterisk package at the 1.6.0 or lower level<br />
<br />
To later upgrade to the current version,<br />
<br />
{{cmd|apk add 'asterisk>1.6.1'}}<br />
<br />
will ensure that 1.6.1 is the minimum version used.<br />
<br />
You can also use "fuzzy" version matching to pin the version to a major/minor release. For example:<br />
<br />
{{cmd|1=apk add 'asterisk=~1.6'}}<br />
<br />
will match any version of asterisk that starts with 1.6 (such as 1.6.0.21-r0 or 1.6.9.31-r9) <ref>[https://git.alpinelinux.org/apk-tools/commit/?id=693b4bcdb0f22904a521a7c8ac4f13e697dc4d71 Alpine source commit message]</ref><br />
<br />
= Troubleshooting =<br />
<br />
== "apk-tools is old" == <br />
<br />
'''apk update''', '''apk upgrade''' or '''apk add''' may report the following: <br />
WARNING: This apk-tools is OLD! Some packages might not function properly<br />
<br />
This may happen if you are running Alpine Linux stable version with a certain edge/main, edge/community or testing package(s) also installed. One resolution is to consider upgrading {{pkg|apk-tools}}. If edge is already [https://wiki.alpinelinux.org/wiki/Alpine_Linux_package_management#Repository_pinning tagged] in your repositories, then try:<br />
<br />
<pre>sudo apk add --upgrade apk-tools@edge</pre><br />
<br />
<br />
[[Category:Package Manager]]</div>Yoonghmhttps://wiki.alpinelinux.org/w/index.php?title=Alpine_Package_Keeper&diff=16449Alpine Package Keeper2019-09-21T12:53:11Z<p>Yoonghm: Typo</p>
<hr />
<div><!--For searching: apk, APK--><br />
<br />
Because Alpine Linux is designed to run from RAM, package management involves two phases:<br />
* Installing / Upgrading / Deleting packages on a running system.<br />
* 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)'''<br />
<br /><br />
'''apk''' is the tool used to install, upgrade, or delete software on a running system.<br /><br />
'''lbu''' is the tool used to capture the data necessary to restore a system to a previously configured state.<br />
<br />
This page documents the [https://git.alpinelinux.org/apk-tools/ apk tool] - See the [[Alpine_local_backup|Alpine Local Backup page]] for the lbu tool.<br />
<br />
= Overview =<br />
<br />
The '''apk''' tool has the following applets:<br />
<br />
{|<br />
| [[#Add a Package|add]] <br />
| Add new packages to the running system<br />
|-<br />
| [[#Remove a Package|del]]<br />
| Delete packages from the running system<br />
|-<br />
| fix <br />
| Attempt to repair or upgrade an installed package <br />
|-<br />
| [[#Update the Package list|update]] <br />
| Update the index of available packages<br />
|-<br />
| [[#Info on Packages|info]]<br />
| Prints information about installed or available packages<br />
|-<br />
| [[#Search for Packages|search]] <br />
| Search for packages or descriptions with wildcard patterns<br />
|-<br />
| [[#Upgrade a Running System|upgrade]]<br />
| Upgrade the currently installed packages<br />
|-<br />
| [[#Cache Maintenance|cache]]<br />
| Maintenance operations for locally cached package repository<br />
|-<br />
| version <br />
| Compare version differences between installed and available packages<br />
|-<br />
| index <br />
| create a repository index from a list of packages<br />
|-<br />
| fetch <br />
| download (but not install) packages<br />
|-<br />
| audit <br />
| List changes to the file system from pristine package install state<br />
|-<br />
| verify <br />
| Verify a package signature<br />
|- <br />
| dot<br />
| Create a [http://graphviz.org/ graphviz] graph description for a given package<br />
|- <br />
| [[#apk_policy|policy]]<br />
| Display the repository that updates a given package, plus repositories that also offer the package<br />
|- <br />
| stats <br />
| Display statistics, including number of packages installed and available, number of directories and files, etc.<br />
|- <br />
| manifest<br />
| Display checksums for files contained in a given package<br />
|}<br />
<br />
= Packages and Repositories =<br />
<br />
Software packages for Alpine Linux are digitally signed tar.gz archives containing programs, configuration files, and dependency metadata. They have the extension <code>.apk</code>, and are often called "a-packs".<br />
<br />
The packages are stored in one or more ''repositories''. A repository is simply a directory with a collection of *.apk files. The directory must include a special index file, named {{Path|APKINDEX.tar.gz}} to be considered a repository.<br />
<br />
The '''apk''' utility can install packages from multiple repositories. The list of repositories to check is stored in {{Path|/etc/apk/repositories}}, one repository per line. If you booted from a USB stick ({{Path|/media/sda1}}) or CD-ROM ({{Path|/media/cdrom}}), your repository file probably looks something like this:<br />
<br />
{{Cat|/etc/apk/repositories|/media/sda1/apks/}}<br />
<br />
In addition to local repositories, the '''apk''' utility uses '''busybox wget''' to fetch packages using ''http:'', ''https:'' or ''ftp:'' protocols. The following is a valid repository file:<br />
<br />
{{Cat|/etc/apk/repositories|<br />
/media/sda1/apks<br />
http://dl-3.alpinelinux.org/alpine/v2.6/main<br />
https://dl-3.alpinelinux.org/alpine/v2.6/main<br />
ftp://dl-3.alpinelinux.org/alpine/v2.6/main<br />
}}<br />
<br />
{{Note| A list of public repositories is in [https://git.alpinelinux.org/cgit/aports/tree/main/alpine-mirrors/mirrors.yaml mirrors.yaml] in the alpine-mirrors git repository. Accepted protocols vary.}}<br />
<br />
== Repository pinning ==<br />
<br />
You can specify additional "tagged" repositories in {{Path|/etc/apk/repositories}}:<br />
<br />
{{Cat|/etc/apk/repositories|<br />
http://nl.alpinelinux.org/alpine/v3.7/main<br />
http://nl.alpinelinux.org/alpine/v3.7/community<br />
@edge http://nl.alpinelinux.org/alpine/edge/main<br />
@edgecommunity http://nl.alpinelinux.org/alpine/edge/community<br />
@testing http://nl.alpinelinux.org/alpine/edge/testing<br />
}}<br />
<br />
After which you can "pin" dependencies to these tags using:<br />
<br />
{{cmd|apk add stableapp newapp@edge bleedingapp@testing}}<br />
<br />
Apk will now by default only use the untagged repositories, but adding a tag to specific package:<br />
<br />
1. will prefer the repository with that tag for the named package, even if a later version of the package is available in another repository<br />
<br />
2. ''allows'' pulling in dependencies for the tagged package from the tagged repository (though it ''prefers'' to use untagged repositories to satisfy dependencies if possible)<br />
<br />
== Commandline repository options ==<br />
<br />
By default, the '''apk''' utility will use the system repositories for all operations. This behavior can be overridden by the following options:<br />
<br />
{|<br />
| --repositories-file REPOFILE<br />
| Override the system repositories by specifying a repositories file.<br />
|-<br />
| <nowiki>-X|--repository REPO</nowiki><br />
| Specify a supplemental repository that will be used in addition to the system repositories. This option can be provided multiple times.<br />
|}<br />
<br />
= Update the Package list =<br />
<br />
Remote repositories change as packages are added and upgraded. To get the latest list of available packages, use the ''update'' command. The command downloads the {{Path|APKINDEX.tar.gz}} from each repository and stores it in the local cache, typically {{Path|/var/cache/apk/}}, {{Path|/var/lib/apk/}} or {{Path|/etc/apk/cache/}}.<br />
<br />
{{Cmd|apk update}}<br />
<br />
<!--<br />
fetch http://dl-3.alpinelinux.org/alpine/v2.1/main/APKINDEX.tar.gz<br />
--><br />
<br />
{{Tip|If using remote repositories, it is a good idea to do an '''update''' just before doing an '''add''' or '''upgrade''' command. That way you know you are using the latest software available.}}<br />
<br />
= Add a Package =<br />
<br />
Use '''add''' to install packages from a repository. Any necessary dependencies are also installed. If you have multiple repositories, the '''add''' command installs the newest package.<br />
<br />
{{Cmd|apk add openssh<br />
apk add openssh openntp vim}}<br />
<br />
If you only have the main repository enabled in your configuration, apk will not include packages from the other repositories. To install a package from the edge/testing repository without changing your repository configuration file, use the command below. This will tell apk to use that particular repository.<br />
<br />
{{cmd|apk add cherokee --update-cache --repository http://dl-3.alpinelinux.org/alpine/edge/testing/ --allow-untrusted}}<br />
<br />
{{Note|Be careful when using third-party or the testing repository. Your system can go down.}}<br />
<br />
= Add a local Package =<br />
<br />
To install a locally available apk package, for example if this device has no internet access but you can upload apk packages directly to it, use the '''--allow-untrusted''' flag:<br />
<br />
{{cmd|apk add --allow-untrusted /path/to/file.apk}}<br />
<br />
Note that multiple packages can be given. When installing a local package, all dependencies should also be specified. For example:<br />
<br />
{{cmd|apk add --allow-untrusted /var/tig-2.2-r0.apk /var/git-2.11.1-20.apk}}<br />
<br />
= Remove a Package =<br />
Use '''del''' to remove a package (and dependencies that are no longer needed.) <br />
<br />
{{cmd|apk del openssh<br />
apk del openssh openntp vim}}<br />
<br />
= Upgrade a Running System =<br />
<br />
To upgrade ''all'' the packages of a running system, use '''upgrade''':<br />
<br />
{{cmd|apk update<br />
apk upgrade<br />
}}<br />
<br />
For example, the procedure on a system that has various [https://wiki.alpinelinux.org/wiki/Alpine_Linux_package_management#Repository_pinning repositories pinned] might display as follows:<br />
<br />
# apk update<br />
fetch http://dl-3.alpinelinux.org/alpine/v3.6/main/x86_64/APKINDEX.tar.gz<br />
fetch http://dl-3.alpinelinux.org/alpine/v3.6/community/x86_64/APKINDEX.tar.gz<br />
fetch http://dl-3.alpinelinux.org/alpine/edge/main/x86_64/APKINDEX.tar.gz<br />
fetch http://dl-3.alpinelinux.org/alpine/edge/community/x86_64/APKINDEX.tar.gz<br />
fetch http://dl-3.alpinelinux.org/alpine/edge/testing/x86_64/APKINDEX.tar.gz<br />
v3.6.2-191-gf98d79930f [http://dl-3.alpinelinux.org/alpine/v3.6/main]<br />
v3.6.2-190-ga5d68c47df [http://dl-3.alpinelinux.org/alpine/v3.6/community]<br />
v3.6.0-4618-g0bf77c9821 [http://dl-3.alpinelinux.org/alpine/edge/main]<br />
v3.6.0-4605-g85ed51dd83 [http://dl-3.alpinelinux.org/alpine/edge/community]<br />
v3.6.0-4624-g11f1b9c8ab [http://dl-3.alpinelinux.org/alpine/edge/testing]<br />
OK: 20118 distinct packages available<br />
<br />
# apk upgrade<br />
(1/2) Upgrading extra-cmake-modules@testing (5.38.0-r0 -> 5.39.0-r0)<br />
(2/2) Upgrading extra-cmake-modules-doc@testing (5.38.0-r0 -> 5.39.0-r0)<br />
Executing mdocml-apropos-1.14.1-r0.trigger<br />
OK: 2635 MiB in 803 packages<br />
<br />
To upgrade ''only a few'' packages, use the '''add''' command with the ''-u'' or ''--upgrade'' option:<br />
<br />
{{cmd|apk update<br />
apk add --upgrade busybox <br />
}}<br />
<br />
{{Note|Remember that when you reboot your machine, the remote repository will not be available until after networking is started. This means packages newer than your local boot media will likely not be installed after a reboot. To make an "upgrade" persist over a reboot, use a [[#Local Cache|local cache]].}}<br />
<br />
= Search for Packages =<br />
The '''search''' command searches the repository Index files for installable packages. <br />
<br />
The return format is '''Package'''-'''Version'''. Omit '''Version''' for ''apk add '''Package'''''<br />
<br />
Examples:<br />
* To list all packages available, along with their descriptions: {{cmd|apk search -v}}<br />
* To list all packages are part of the ACF system: {{cmd|apk search -v 'acf*' }}<br />
* To list all packages that list NTP as part of their description, use the ''-d'' or ''--description'' option: {{cmd|apk search -v --description 'NTP' }}<br />
<br />
= Information on Packages =<br />
<br />
== apk info ==<br />
<br />
The '''info''' command provides information on the contents of packages, their dependencies, and which files belong to a package.<br />
<br />
For a given package, each element can be chosen (for example, ''-w'' to show just the webpage information), or all information displayed with the ''-a'' command.<br />
<br />
Example: {{cmd|apk info -a zlib}}<br />
<br />
'''zlib-1.2.5-r1 description:'''<br />
A compression/decompression Library<br />
<br />
'''zlib-1.2.5-r1 webpage:'''<br />
<nowiki>http://zlib.net</nowiki><br />
<br />
'''zlib-1.2.5-r1 installed size:'''<br />
94208<br />
<br />
'''zlib-1.2.5-r1 depends on:'''<br />
libc0.9.32<br />
<br />
'''zlib-1.2.5-r1 is required by:'''<br />
libcrypto1.0-1.0.0-r0<br />
apk-tools-2.0.2-r4<br />
openssh-client-5.4_p1-r2<br />
openssh-5.4_p1-r2<br />
libssl1.0-1.0.0-r0<br />
freeswitch-1.0.6-r6<br />
atop-1.25-r0 <br />
<br />
'''zlib-1.2.5-r1 contains:'''<br />
lib/libz.so.1.2.5<br />
lib/libz.so.1<br />
lib/libz.so <br />
<br />
'''zlib-1.2.5-r1 triggers:'''<br />
<br />
As shown in the example you can determine<br />
* The '''description''' of the package (''-d'' or ''--description'')<br />
* The '''webpage''' where the application is hosted (''-w'' or ''--webpage'')<br />
* The '''size''' the package will require once installed (in bytes) (''-s'' or ''--size'')<br />
* What packages are required to use this one ('''depends''') (''-R'' or ''--depends'')<br />
* What packages require this one to be installed ('''required by''') (''-r'' or ''--rdepends'')<br />
* The '''contents''' of the package, that is, which files it installs (''-L'' or ''--contents'')<br />
* Any '''triggers''' this package sets. (''-t'' or ''--triggers'') Listed here are directories that are watched; if a change happens to the directory, then the trigger script is run at the end of the apk add/delete. For example, doing a depmod once after installing all packages that add kernel modules.<br />
<br />
{{Tip|The '''info''' command is also useful to determine which package a file belongs to. For example: {{cmd|apk info --who-owns /sbin/lbu}} will display<br />
<br />
/sbin/lbu is owned by alpine-conf-x.x-rx<br />
}}<br />
<br />
=== Listing installed packages ===<br />
<br />
To list all installed packages, use:<br />
<br />
<pre>apk info</pre><br />
<br />
To list all installed packages in alphabetical order, with a description of each, do:<br />
<br />
<pre>apk -vv info|sort</pre><br />
<br />
== apk policy ==<br />
<br />
To display the repository a package was installed from and will be updated from, plus any [https://wiki.alpinelinux.org/wiki/Alpine_Linux_package_management#Repository_pinning tagged] or enabled repositories where it is also offered, if any, for this architecture - its '''policy''':<br />
<br />
apk policy ''package''<br />
<br />
For example:<br />
<pre><br />
$ apk policy vlc<br />
vlc policy:<br />
2.2.6-r1:<br />
lib/apk/db/installed<br />
http://dl-3.alpinelinux.org/alpine/v3.7/community<br />
3.0.0_rc2-r1:<br />
@edgecommunity http://dl-3.alpinelinux.org/alpine/edge/community<br />
</pre><br />
<br />
= Additional apk Commands =<br />
In progress...<br />
<br />
= Local Cache =<br />
<br />
{{:Local_APK_cache}}<br />
<br />
= Advanced APK Usage =<br />
<br />
== Holding a specific package back ==<br />
<br />
In certain cases, you may want to upgrade a system, but keep a specific package at a back level. It is possible to add "sticky" or versioned dependencies. For instance, to hold the ''asterisk'' package to the 1.6.2 level or lower:<br />
{{cmd|1=apk add asterisk=1.6.0.21-r0}}<br />
or<br />
{{cmd|apk add 'asterisk<1.6.1'}}<br />
<br />
after which a {{cmd|apk upgrade}}<br />
<br />
will upgrade the entire system, keeping the asterisk package at the 1.6.0 or lower level<br />
<br />
To later upgrade to the current version,<br />
<br />
{{cmd|apk add 'asterisk>1.6.1'}}<br />
<br />
will ensure that 1.6.1 is the minimum version used.<br />
<br />
You can also use "fuzzy" version matching to pin the version to a major/minor release. For example:<br />
<br />
{{cmd|1=apk add 'asterisk=~1.6'}}<br />
<br />
will match any version of asterisk that starts with 1.6 (such as 1.6.0.21-r0 or 1.6.9.31-r9) <ref>[https://git.alpinelinux.org/apk-tools/commit/?id=693b4bcdb0f22904a521a7c8ac4f13e697dc4d71 Alpine source commit message]</ref><br />
<br />
= Troubleshooting =<br />
<br />
== "apk-tools is old" == <br />
<br />
'''apk update''', '''apk upgrade''' or '''apk add''' may report the following: <br />
WARNING: This apk-tools is OLD! Some packages might not function properly<br />
<br />
This may happen if you are running Alpine Linux stable version with a certain edge/main, edge/community or testing package(s) also installed. One resolution is to consider upgrading {{pkg|apk-tools}}. If edge is already [https://wiki.alpinelinux.org/wiki/Alpine_Linux_package_management#Repository_pinning tagged] in your repositories, then try:<br />
<br />
<pre>sudo apk add --upgrade apk-tools@edge</pre><br />
<br />
<br />
[[Category:Package Manager]]</div>Yoonghmhttps://wiki.alpinelinux.org/w/index.php?title=Installation&diff=16448Installation2019-09-19T11:18:42Z<p>Yoonghm: /* Installation Quick-Start in 3 Easy Steps */</p>
<hr />
<div>The following information will assist you with the installation of [http://alpinelinux.org/about Alpine Linux].<br />
[[Image:hdd_mount.png|left|link=]]<br />
<br /><br />
<br />
== Installation Quick-Start in 3 Easy Steps ==<br />
<div style="float:left; font-size:30px; font-weight:bold;"><br />
1st<br />
</div><br />
<div style="margin-left:65px; background-color:#EDF2F2; border-style:solid; border-color:#6F7C91; border-width:0px; border-left-width:5px; min-height:55px; padding:5px;"><br />
[http://alpinelinux.org/downloads Download] one of the latest stable-release ISOs. Then compare the image's checksum to the one in the corresponding checksum file (<code>*.sha256</code>) and verify its GPG signature.<br />
</div><br />
<br />
<br />
<div style="float:left; font-size:30px; font-weight:bold;"><br />
2nd<br />
</div><br />
<div style="margin-left:65px; background-color:#E0E9E9; border-style:solid; border-color:#606A82; border-width:0px; border-left-width:5px; min-height:55px; padding:5px;"><br />
If you have a CD drive from which you can boot, then [[Burning ISOs|burn the ISO onto a blank CD]] using your favorite CD burning software. Else [[Create a Bootable USB|create a bootable USB drive]].<br />
</div><br />
<br />
<br />
<div style="float:left; font-size:30px; font-weight:bold;"><br />
3rd<br />
</div><br />
<div style="margin-left:65px; background-color:#9faecc; border-style:solid; border-color:#324065; border-width:0px; border-left-width:5px; min-height:55px; padding:5px;"><br />
Boot from the CD or USB drive, login as root with no password, and voilĂ ! Enjoy Alpine Linux!<br />
</div><br />
<br />
{{Clear}}<br />
<br />
Now Alpine are complete running from the media source, '''you can install it''' by running the <code>[[setup-alpine]]</code> command.<br />
<br />
Before runs <code>[[setup-alpine]]</code> there's many ways and '''use cases in the [[Alpine_newbie_install_manual#Ways_to_install_Alpine_into_machines_or_virtuals|Alpine install manual for beginners]]'''<br />
<br />
= Installation Handbook =<br />
<br />
Alpine can be booted or not, just use it. Alpine Linux installation process are so flexible that indeed can just boot up inside other broken Linux. '''You believe that every system needs a DVD disc, or a USB to install it?, but Alpine may not even need it''', so much so that it can even boot from its phone memory. Obviously '''the more exquisite the more complicated method'''. <br />
<br />
A proper setup of your system are need, but if you deploy all of an ecosystems in your own home and job.. in your only machine... you will need a proper guide to setup your main system (or maybe a parallel system?).<br />
<br />
As any Linux installation, Alpine start process by booting from an external device (CD/DVD, USB Drive, etc...).<br />
<br />
As Alpine uses Linux kernel, start step of collecting information to initialize a minimum system, the <code>[[setup-alpine]]</code> will copy files. This minimun system started before proceed to property install are a [[Alpine_newbie_install_manual#diskless_mode|diskless mode]] started from the orig medium.<br />
<br />
The post installation step provides the way to choose the root password, and eventually boot up the new installed system.<br />
<br />
=== Overview of run modes for Alpine system ===<br />
<br />
Alpine can be used in any of '''three modes respected the install process''':<br />
<br />
== diskless mode ==<br />
<br />
You'll boot from a read-only medium such as the installation CD, a [[Create a Bootable USB|USB drive]], or a [[Create a Bootable Compact Flash|Compact Flash card]]. {{Tip| To prepare either a USB or Compact Flash card, you can use the <code>[[setup-bootable]]</code> script; see the pages linked above for details.}} When you use Alpine in this mode, you need to use [[Alpine local backup|Alpine Local Backup (lbu)]] to save your modifications between reboots. That requires some writable medium, usually removable. If your boot medium is, for example, a USB drive, you can save modifications there; you don't need a separate partition or drive. See also [[Local APK cache]].<br />
{{Note| When the <code>[[setup-alpine]]</code> script asks for a disk, say "none". It will then prompt whether you'd like to preserve modifications on any writable medium.}}<br />
<br />
== data mode ==<br />
<br />
As in diskless mode, your OS is run from a read-only medium. However, here a writable partition (usually on a hard disk) is used to store the data in {{Path|/var}}. That partition is accessed directly, rather than copied into a tmpfs; so this is better-suited to uses where large amounts of data need to be preserved between reboots. {{Note| The <code>[[setup-alpine]]</code> script handles installing Alpine in this mode, too, when you supply a writable partition instead of "none", and request mode "data".}} This mode may be used for mailspools, database and log servers, and so on.<br />
<br />
== sys mode ==<br />
<br />
This is a [[Install to disk|traditional hard-disk install]] (see link for details). <!-- includes [[Installing Alpine on HDD overwriting everything]] --> Both the boot system and your modifications are written to the hard disk in a standard Linux hierarchy. {{Note| The <code>[[setup-alpine]]</code> script handles installing Alpine in this mode, too, when you supply a writable partition instead of "none", and request mode "sys". By default, it will create three partions on your disk for {{Path|/boot}}, {{Path|/}}, and {{Path|swap}}; however you can also [[Setting up disks manually|partition your disk manually]].<br />
}} This mode may be used for [[Desktops|desktops]], development boxes, and virtual servers.<br />
<!-- [[Native Harddisk Install 1.6]] Obsolete --><br />
<br />
= Further Documentation =<br />
<br />
=== Post-Install ===<br />
<br />
<!-- If you edit this, please coordinate with and Tutorials_and_Howtos#Post-Install and Developer_Documentation#Package_management. Note that these three sections are not exact duplicates. --><br />
<br />
<!-- [[Configure Networking]] --><br />
* [[Tutorials_and_Howtos#Networking|Setting up Networking]]<br />
* [[Alpine Linux package management|Package Management (apk)]] ''(How to add/remove packages on your Alpine)''<br />
<!-- [[Alpine Linux package management#Local_Cache|How to enable APK caching]] --><br />
* [[Alpine local backup|Alpine local backup (lbu)]] ''(Permanently store your modifications in case your box needs reboot)''<br />
** [[Back Up a Flash Memory Installation|Back Up a Flash Memory ("diskless mode") Installation]]<br />
** [[Manually editing a existing apkovl]]<br />
* [[Alpine Linux Init System|Init System (OpenRC)]] ''(Configure a service to automatically boot at next reboot)''<br />
** [[Multiple Instances of Services]]<br />
<!-- [[Writing Init Scripts]] --><br />
* [[Alpine setup scripts#setup-xorg-base|Setting up Xorg]]<br />
<br />
* [[Upgrading Alpine]]<br />
<!-- Obsolete<br />
[[Upgrading Alpine - v1.9.x]]<br />
[[Upgrading Alpine - CD v1.8.x]]<br />
[[Upgrading Alpine - HD v1.8.x]]<br />
[[Upgrade to repository main|Upgrading to signed repositories]]<br />
--><br />
<br />
* [[Setting up a ssh-server]] ''(Using ssh is a good way to administer your box remotely)''<br />
* [[setup-acf]] ''(Configures ACF (webconfiguration) so you can manage your box through https)''<br />
* [[Hosting services on Alpine]]''(Links to several mail/web/ssh server setup pages)''<br />
* [[Changing passwords for ACF|Changing passwords]]<br />
<br />
<!-- [[Running glibc programs]] Installation and Dev --><br />
* [[Setting the timezone]] ''(Not needed for the default musl- or uClibc-based installs)''<br />
<br />
* [[Setting up a new user]]<br />
<br />
=== Further Help and Information ===<br />
<br />
* [[FAQ|FAQs]]<br />
* [[Tutorials and Howtos]]<br />
* [[Contribute|How to Contribute]]<br />
* [[Developer Documentation]]<br />
<br />
= See Also =<br />
<br />
# [[Newbie_Alpine_Ecosystem]]<br />
# [[Alpine newbie install manual]]<br />
<br />
[[Category:Installation]]</div>Yoonghmhttps://wiki.alpinelinux.org/w/index.php?title=Installation&diff=16447Installation2019-09-19T11:17:53Z<p>Yoonghm: /* Installation Quick-Start in 3 Easy Steps */</p>
<hr />
<div>The following information will assist you with the installation of [http://alpinelinux.org/about Alpine Linux].<br />
[[Image:hdd_mount.png|left|link=]]<br />
<br /><br />
<br />
== Installation Quick-Start in 3 Easy Steps ==<br />
<div style="float:left; font-size:30px; font-weight:bold;"><br />
1st<br />
</div><br />
<div style="margin-left:65px; background-color:#EDF2F2; border-style:solid; border-color:#6F7C91; border-width:0px; border-left-width:5px; min-height:55px; padding:5px;"><br />
[http://alpinelinux.org/downloads Download] one of the latest stable-release ISOs. Then compare the image's checksum to the one in the corresponding checksum file (<code>*.sha256</code>) and verify its GPG signature.<br />
</div><br />
<br />
<br />
<div style="float:left; font-size:30px; font-weight:bold;"><br />
2nd<br />
</div><br />
<div style="margin-left:65px; background-color:#E0E9E9; border-style:solid; border-color:#606A82; border-width:0px; border-left-width:5px; min-height:55px; padding:5px;"><br />
If you have a CD drive from which you can boot, then [[Burning ISOs|burn the ISO onto a blank CD]] using your favorite CD burning software. Else [[Create a Bootable USB|create a bootable USB drive]].<br />
</div><br />
<br />
<br />
<div style="float:left; font-size:30px; font-weight:bold;"><br />
3rd<br />
</div><br />
<div style="margin-left:65px; background-color:#9faecc; border-style:solid; border-color:#324065; border-width:0px; border-left-width:5px; min-height:55px; padding:5px;"><br />
Boot from the CD or USB drive, login as root with no password, and voilĂ ! Enjoy Alpine Linux!<br />
</div><br />
<br />
{{Clear}}<br />
<br />
Now Alpine are complete running from the media source, '''you can install it''' by running the <code>[[setup-alpine]]</code> command.<br />
<br />
Before runs <code>[[setup-alpine]]</code> there's many ways and '''use cases in the [[Alpine_newbie_install_manual#Ways_to_install_Alpine_into_machines_or_virtuals|Alpine install manual for beginers]]'''<br />
<br />
= Installation Handbook =<br />
<br />
Alpine can be booted or not, just use it. Alpine Linux installation process are so flexible that indeed can just boot up inside other broken Linux. '''You believe that every system needs a DVD disc, or a USB to install it?, but Alpine may not even need it''', so much so that it can even boot from its phone memory. Obviously '''the more exquisite the more complicated method'''. <br />
<br />
A proper setup of your system are need, but if you deploy all of an ecosystems in your own home and job.. in your only machine... you will need a proper guide to setup your main system (or maybe a parallel system?).<br />
<br />
As any Linux installation, Alpine start process by booting from an external device (CD/DVD, USB Drive, etc...).<br />
<br />
As Alpine uses Linux kernel, start step of collecting information to initialize a minimum system, the <code>[[setup-alpine]]</code> will copy files. This minimun system started before proceed to property install are a [[Alpine_newbie_install_manual#diskless_mode|diskless mode]] started from the orig medium.<br />
<br />
The post installation step provides the way to choose the root password, and eventually boot up the new installed system.<br />
<br />
=== Overview of run modes for Alpine system ===<br />
<br />
Alpine can be used in any of '''three modes respected the install process''':<br />
<br />
== diskless mode ==<br />
<br />
You'll boot from a read-only medium such as the installation CD, a [[Create a Bootable USB|USB drive]], or a [[Create a Bootable Compact Flash|Compact Flash card]]. {{Tip| To prepare either a USB or Compact Flash card, you can use the <code>[[setup-bootable]]</code> script; see the pages linked above for details.}} When you use Alpine in this mode, you need to use [[Alpine local backup|Alpine Local Backup (lbu)]] to save your modifications between reboots. That requires some writable medium, usually removable. If your boot medium is, for example, a USB drive, you can save modifications there; you don't need a separate partition or drive. See also [[Local APK cache]].<br />
{{Note| When the <code>[[setup-alpine]]</code> script asks for a disk, say "none". It will then prompt whether you'd like to preserve modifications on any writable medium.}}<br />
<br />
== data mode ==<br />
<br />
As in diskless mode, your OS is run from a read-only medium. However, here a writable partition (usually on a hard disk) is used to store the data in {{Path|/var}}. That partition is accessed directly, rather than copied into a tmpfs; so this is better-suited to uses where large amounts of data need to be preserved between reboots. {{Note| The <code>[[setup-alpine]]</code> script handles installing Alpine in this mode, too, when you supply a writable partition instead of "none", and request mode "data".}} This mode may be used for mailspools, database and log servers, and so on.<br />
<br />
== sys mode ==<br />
<br />
This is a [[Install to disk|traditional hard-disk install]] (see link for details). <!-- includes [[Installing Alpine on HDD overwriting everything]] --> Both the boot system and your modifications are written to the hard disk in a standard Linux hierarchy. {{Note| The <code>[[setup-alpine]]</code> script handles installing Alpine in this mode, too, when you supply a writable partition instead of "none", and request mode "sys". By default, it will create three partions on your disk for {{Path|/boot}}, {{Path|/}}, and {{Path|swap}}; however you can also [[Setting up disks manually|partition your disk manually]].<br />
}} This mode may be used for [[Desktops|desktops]], development boxes, and virtual servers.<br />
<!-- [[Native Harddisk Install 1.6]] Obsolete --><br />
<br />
= Further Documentation =<br />
<br />
=== Post-Install ===<br />
<br />
<!-- If you edit this, please coordinate with and Tutorials_and_Howtos#Post-Install and Developer_Documentation#Package_management. Note that these three sections are not exact duplicates. --><br />
<br />
<!-- [[Configure Networking]] --><br />
* [[Tutorials_and_Howtos#Networking|Setting up Networking]]<br />
* [[Alpine Linux package management|Package Management (apk)]] ''(How to add/remove packages on your Alpine)''<br />
<!-- [[Alpine Linux package management#Local_Cache|How to enable APK caching]] --><br />
* [[Alpine local backup|Alpine local backup (lbu)]] ''(Permanently store your modifications in case your box needs reboot)''<br />
** [[Back Up a Flash Memory Installation|Back Up a Flash Memory ("diskless mode") Installation]]<br />
** [[Manually editing a existing apkovl]]<br />
* [[Alpine Linux Init System|Init System (OpenRC)]] ''(Configure a service to automatically boot at next reboot)''<br />
** [[Multiple Instances of Services]]<br />
<!-- [[Writing Init Scripts]] --><br />
* [[Alpine setup scripts#setup-xorg-base|Setting up Xorg]]<br />
<br />
* [[Upgrading Alpine]]<br />
<!-- Obsolete<br />
[[Upgrading Alpine - v1.9.x]]<br />
[[Upgrading Alpine - CD v1.8.x]]<br />
[[Upgrading Alpine - HD v1.8.x]]<br />
[[Upgrade to repository main|Upgrading to signed repositories]]<br />
--><br />
<br />
* [[Setting up a ssh-server]] ''(Using ssh is a good way to administer your box remotely)''<br />
* [[setup-acf]] ''(Configures ACF (webconfiguration) so you can manage your box through https)''<br />
* [[Hosting services on Alpine]]''(Links to several mail/web/ssh server setup pages)''<br />
* [[Changing passwords for ACF|Changing passwords]]<br />
<br />
<!-- [[Running glibc programs]] Installation and Dev --><br />
* [[Setting the timezone]] ''(Not needed for the default musl- or uClibc-based installs)''<br />
<br />
* [[Setting up a new user]]<br />
<br />
=== Further Help and Information ===<br />
<br />
* [[FAQ|FAQs]]<br />
* [[Tutorials and Howtos]]<br />
* [[Contribute|How to Contribute]]<br />
* [[Developer Documentation]]<br />
<br />
= See Also =<br />
<br />
# [[Newbie_Alpine_Ecosystem]]<br />
# [[Alpine newbie install manual]]<br />
<br />
[[Category:Installation]]</div>Yoonghm