docs(run-on-alpine.md): update for Alpine's kernel changes (#712)

Co-authored-by: Markson Hon <markson@localhost.local>
This commit is contained in:
Markson Hon
2024-12-09 20:28:35 +08:00
committed by GitHub
parent 1404f1a03b
commit 8bfbce7fb4
2 changed files with 101 additions and 34 deletions

View File

@ -1,37 +1,28 @@
# Run on Alpine Linux
**Note**: Alpine Linux 3.18 or newer verison has full eBPF support out-of-box, older version of Alpine Linux need to build kernel by yourself.
**Note:**
1. Alpine Linux 3.18 or newer verison has full eBPF support out-of-box, older version of Alpine Linux need to build kernel by yourself.
2. From version 3.20, Alpine Linux has officially disabled some features dae needed beacuse of Alpine Linux's cross CPU architectures compatibility, so only `linux-virt` can be used to run dae defaultly. For `linux-lts` or `linux-edge`, you should build the kernel by yourself.
3. This tutorial is for Alpine Linux 3.20 and newer.
## Enable Community Repo
Edit apk's repositories config:
Run `setup-apkrepos` command, then you'll get a menu list like this:
```sh
vi /etc/apk/repositories
```
(f) Find and use fastest mirror
(s) Show mirrorlist
(r) Use random mirror
(e) Edit /etc/apk/repositories with text editor
(c) Community repo enable
(skip) Skip setting up apk repositories
```
Then enable community repo, for example:
Then input `c` to enable community repo.
```ini
https://dl-cdn.alpinelinux.org/alpine/edge/main
https://dl-cdn.alpinelinux.org/alpine/edge/community
```
## Enable CGroups
## Enable CGroup2
Edit OpenRC's config file:
```sh
vi /etc/rc.conf
```
Then edit `rc_cgroup_mode`, defaultly it would be `#rc_cgroup_mode="hybrid"`, we should switch to `unified` to make sure CGroup2 in default.
```ini
rc_cgroup_mode="unified"
```
Then enable `cgroups` service:
Enable `cgroups` service:
```sh
rc-update add cgroups boot
@ -48,17 +39,17 @@ vi /etc/init.d/sysfs
Add the following to the `mount_misc` section:
```sh
# Setup Kernel Support for bpf file system
if [ -d /sys/fs/bpf ] && ! mountinfo -q /sys/fs/bpf; then
if grep -qs bpf /proc/filesystems; then
ebegin "Mounting eBPF filesystem"
mount -n -t bpf -o ${sysfs_opts} bpffs /sys/fs/bpf
eend $?
# Setup Kernel Support for bpf file system
if [ -d /sys/fs/bpf ] && ! mountinfo -q /sys/fs/bpf; then
if grep -qs bpf /proc/filesystems; then
ebegin "Mounting eBPF filesystem"
mount -n -t bpf -o ${sysfs_opts} bpffs /sys/fs/bpf
eend $?
fi
fi
fi
```
Be careful that the format of the script `/etc/init.d/sysfs` must be fine, or `sysfs` service will be failed.
Be careful that the format of the script `/etc/init.d/sysfs` must be correct, or `sysfs` service will be failed.
## Install dae
@ -70,13 +61,13 @@ This installer offered an OpenRC service script of dae, after installation, you
chmod 640 /usr/local/etc/dae/config.dae
```
If your config file is OK, then you can start dae service:
If your config file is ready to work, then you can start dae service:
```sh
rc-service dae start
```
## Start at boot
## Start dae at boot
Use `rc-update` to enable dae service: