author | Oleksandr Gavenko <gavenkoa@gmail.com> |
Sun, 15 Nov 2020 16:55:51 +0200 | |
changeset 2458 | 28c248a41a85 |
parent 2455 | 654f7a5ea92d |
permissions | -rw-r--r-- |
2234 | 1 |
.. -*- coding: utf-8; -*- |
2 |
||
3 |
===================== |
|
4 |
Alpine Linux distro |
|
5 |
===================== |
|
6 |
.. contents:: |
|
7 |
:local: |
|
8 |
||
2235
eb6107487d83
Alpine Linux Init System.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
2234
diff
changeset
|
9 |
Init system |
eb6107487d83
Alpine Linux Init System.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
2234
diff
changeset
|
10 |
=========== |
eb6107487d83
Alpine Linux Init System.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
2234
diff
changeset
|
11 |
|
eb6107487d83
Alpine Linux Init System.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
2234
diff
changeset
|
12 |
Manage run levels:: |
eb6107487d83
Alpine Linux Init System.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
2234
diff
changeset
|
13 |
|
eb6107487d83
Alpine Linux Init System.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
2234
diff
changeset
|
14 |
rc-update add $SERVICE $LEVEL |
eb6107487d83
Alpine Linux Init System.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
2234
diff
changeset
|
15 |
rc-update del $SERVICE $LEVEL |
2296
2a1cf17e9552
Alpine package manager.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
2287
diff
changeset
|
16 |
|
2a1cf17e9552
Alpine package manager.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
2287
diff
changeset
|
17 |
Run levels meaning: |
2a1cf17e9552
Alpine package manager.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
2287
diff
changeset
|
18 |
|
2a1cf17e9552
Alpine package manager.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
2287
diff
changeset
|
19 |
Starting/stopping services:: |
2a1cf17e9552
Alpine package manager.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
2287
diff
changeset
|
20 |
|
2a1cf17e9552
Alpine package manager.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
2287
diff
changeset
|
21 |
rc-service $SERVICE status |
2235
eb6107487d83
Alpine Linux Init System.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
2234
diff
changeset
|
22 |
rc-service $SERVICE start |
2296
2a1cf17e9552
Alpine package manager.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
2287
diff
changeset
|
23 |
rc-service $SERVICE stop |
2235
eb6107487d83
Alpine Linux Init System.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
2234
diff
changeset
|
24 |
rc-service $SERVICE restart |
eb6107487d83
Alpine Linux Init System.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
2234
diff
changeset
|
25 |
|
eb6107487d83
Alpine Linux Init System.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
2234
diff
changeset
|
26 |
Equivalent to shutdown -r now from traditional GNU/Linux systems:: |
eb6107487d83
Alpine Linux Init System.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
2234
diff
changeset
|
27 |
|
eb6107487d83
Alpine Linux Init System.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
2234
diff
changeset
|
28 |
reboot |
eb6107487d83
Alpine Linux Init System.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
2234
diff
changeset
|
29 |
|
eb6107487d83
Alpine Linux Init System.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
2234
diff
changeset
|
30 |
Equivalent to shutdown -h now from traditional GNU/Linux systems:: |
eb6107487d83
Alpine Linux Init System.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
2234
diff
changeset
|
31 |
|
eb6107487d83
Alpine Linux Init System.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
2234
diff
changeset
|
32 |
halt |
eb6107487d83
Alpine Linux Init System.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
2234
diff
changeset
|
33 |
|
eb6107487d83
Alpine Linux Init System.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
2234
diff
changeset
|
34 |
To turn off the machine:: |
eb6107487d83
Alpine Linux Init System.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
2234
diff
changeset
|
35 |
|
eb6107487d83
Alpine Linux Init System.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
2234
diff
changeset
|
36 |
poweroff |
eb6107487d83
Alpine Linux Init System.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
2234
diff
changeset
|
37 |
|
eb6107487d83
Alpine Linux Init System.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
2234
diff
changeset
|
38 |
https://wiki.alpinelinux.org/wiki/Alpine_Linux_Init_System |
eb6107487d83
Alpine Linux Init System.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
2234
diff
changeset
|
39 |
Alpine Linux Init System |
eb6107487d83
Alpine Linux Init System.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
2234
diff
changeset
|
40 |
|
2234 | 41 |
Package manager |
42 |
=============== |
|
43 |
||
44 |
Update local package database:: |
|
45 |
||
46 |
$ sudo apk update |
|
47 |
||
2296
2a1cf17e9552
Alpine package manager.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
2287
diff
changeset
|
48 |
Upgrade packages to latest version:: |
2234 | 49 |
|
50 |
$ sudo apk upgrade |
|
51 |
||
2296
2a1cf17e9552
Alpine package manager.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
2287
diff
changeset
|
52 |
Upgrade only specific package:: |
2a1cf17e9552
Alpine package manager.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
2287
diff
changeset
|
53 |
|
2a1cf17e9552
Alpine package manager.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
2287
diff
changeset
|
54 |
$ sudo apk add -u busybox |
2a1cf17e9552
Alpine package manager.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
2287
diff
changeset
|
55 |
|
2234 | 56 |
Install package:: |
57 |
||
58 |
$ sudo apk add bash |
|
2325
b127237b615f
Install package from specific Alpine release.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
2296
diff
changeset
|
59 |
|
b127237b615f
Install package from specific Alpine release.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
2296
diff
changeset
|
60 |
Install local package:: |
b127237b615f
Install package from specific Alpine release.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
2296
diff
changeset
|
61 |
|
2296
2a1cf17e9552
Alpine package manager.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
2287
diff
changeset
|
62 |
$ sudo apk add --allow-untrusted /path/to/file.apk |
2234 | 63 |
|
2325
b127237b615f
Install package from specific Alpine release.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
2296
diff
changeset
|
64 |
To install package from specific Alpine release tag extra repository URL in |
b127237b615f
Install package from specific Alpine release.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
2296
diff
changeset
|
65 |
``/etc/apk/repositories``:: |
b127237b615f
Install package from specific Alpine release.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
2296
diff
changeset
|
66 |
|
b127237b615f
Install package from specific Alpine release.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
2296
diff
changeset
|
67 |
@edge http://nldl-cdn.alpinelinux.org/alpine/edge/main |
b127237b615f
Install package from specific Alpine release.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
2296
diff
changeset
|
68 |
|
b127237b615f
Install package from specific Alpine release.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
2296
diff
changeset
|
69 |
and pin dependencies to tag:: |
b127237b615f
Install package from specific Alpine release.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
2296
diff
changeset
|
70 |
|
b127237b615f
Install package from specific Alpine release.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
2296
diff
changeset
|
71 |
$ sudo apk add bash@edge |
b127237b615f
Install package from specific Alpine release.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
2296
diff
changeset
|
72 |
|
b127237b615f
Install package from specific Alpine release.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
2296
diff
changeset
|
73 |
To avoid registering repository in ``/etc/apk/repositories`` pass repository URL and fixate package |
b127237b615f
Install package from specific Alpine release.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
2296
diff
changeset
|
74 |
version:: |
b127237b615f
Install package from specific Alpine release.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
2296
diff
changeset
|
75 |
|
b127237b615f
Install package from specific Alpine release.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
2296
diff
changeset
|
76 |
$ sudo apk add postgresql==9.6.10-r0 --no-cache --repository=http://dl-cdn.alpinelinux.org/alpine/v3.6/main |
b127237b615f
Install package from specific Alpine release.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
2296
diff
changeset
|
77 |
|
b127237b615f
Install package from specific Alpine release.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
2296
diff
changeset
|
78 |
To select Alpine release, package and package version use https://pkgs.alpinelinux.org/packages |
b127237b615f
Install package from specific Alpine release.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
2296
diff
changeset
|
79 |
|
2287
fcdd583e8795
Fixed RST syntax: Inline literal start-string without end-string.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
2235
diff
changeset
|
80 |
Do not grab package index with ``--no-cache`` option to reduce installation size:: |
2234 | 81 |
|
82 |
$ apk add --no-cache bash |
|
83 |
||
2296
2a1cf17e9552
Alpine package manager.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
2287
diff
changeset
|
84 |
Remove package:: |
2a1cf17e9552
Alpine package manager.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
2287
diff
changeset
|
85 |
|
2a1cf17e9552
Alpine package manager.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
2287
diff
changeset
|
86 |
$ sudo apk del openssh |
2a1cf17e9552
Alpine package manager.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
2287
diff
changeset
|
87 |
|
2a1cf17e9552
Alpine package manager.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
2287
diff
changeset
|
88 |
Search for packages:: |
2a1cf17e9552
Alpine package manager.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
2287
diff
changeset
|
89 |
|
2a1cf17e9552
Alpine package manager.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
2287
diff
changeset
|
90 |
$ apk search 'emacs*' |
2a1cf17e9552
Alpine package manager.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
2287
diff
changeset
|
91 |
$ apk search -v 'emacs*' |
2a1cf17e9552
Alpine package manager.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
2287
diff
changeset
|
92 |
|
2a1cf17e9552
Alpine package manager.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
2287
diff
changeset
|
93 |
List of installed packages:: |
2a1cf17e9552
Alpine package manager.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
2287
diff
changeset
|
94 |
|
2a1cf17e9552
Alpine package manager.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
2287
diff
changeset
|
95 |
$ apk info |
2a1cf17e9552
Alpine package manager.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
2287
diff
changeset
|
96 |
|
2455
654f7a5ea92d
Added note: full path is required.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
2454
diff
changeset
|
97 |
Package owning file (full path is required!):: |
2296
2a1cf17e9552
Alpine package manager.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
2287
diff
changeset
|
98 |
|
2454
d99f1babbb10
Added come short/long options variations.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
2325
diff
changeset
|
99 |
$ apk info -W `which apk` |
2296
2a1cf17e9552
Alpine package manager.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
2287
diff
changeset
|
100 |
$ apk info --who-owns `which apk` |
2a1cf17e9552
Alpine package manager.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
2287
diff
changeset
|
101 |
|
2a1cf17e9552
Alpine package manager.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
2287
diff
changeset
|
102 |
Show package content:: |
2a1cf17e9552
Alpine package manager.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
2287
diff
changeset
|
103 |
|
2a1cf17e9552
Alpine package manager.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
2287
diff
changeset
|
104 |
$ apk info -L $PKG |
2454
d99f1babbb10
Added come short/long options variations.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
2325
diff
changeset
|
105 |
$ apk info --contents $PKG |
2296
2a1cf17e9552
Alpine package manager.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
2287
diff
changeset
|
106 |
|
2a1cf17e9552
Alpine package manager.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
2287
diff
changeset
|
107 |
Developing Apline |
2a1cf17e9552
Alpine package manager.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
2287
diff
changeset
|
108 |
================= |
2a1cf17e9552
Alpine package manager.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
2287
diff
changeset
|
109 |
|
2a1cf17e9552
Alpine package manager.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
2287
diff
changeset
|
110 |
:: |
2a1cf17e9552
Alpine package manager.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
2287
diff
changeset
|
111 |
|
2a1cf17e9552
Alpine package manager.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
2287
diff
changeset
|
112 |
$ apk add -U build-base |
2a1cf17e9552
Alpine package manager.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
2287
diff
changeset
|
113 |
$ apk add -U alpine-sdk |
2a1cf17e9552
Alpine package manager.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
2287
diff
changeset
|
114 |