MENU

Alpine 安装软件时提示包不存在

September 10, 2022 • Read: 1708 • Linux,编码

当安装一些包时,发现 官方仓库没有相应的软件包 例如 php docker,这时则可以通过添加第三方仓库来实现 apk 来安装这些包。

vi /etc/apk/repositories
http://dl-cdn.alpinelinux.org/alpine/latest-stable/community

保存后 更新本地索引:

dbkuaizi-alpine:~# apk update
fetch https://mirrors.aliyun.com/alpine/v3.16/main/x86_64/APKINDEX.tar.gz
fetch http://dl-cdn.alpinelinux.org/alpine/latest-stable/community/x86_64/APKINDEX.tar.gz
v3.16.2-140-gb38ba50d49 [https://mirrors.aliyun.com/alpine/v3.16/main]
v3.16.2-148-g578ca606ff [http://dl-cdn.alpinelinux.org/alpine/latest-stable/community]
OK: 17051 distinct packages available

尝试安装一个 PHP 试试:

dbkuaizi-alpine:~# apk add php81
(1/4) Installing php81-common (8.1.9-r0)
(2/4) Installing pcre2 (10.40-r0)
(3/4) Installing libxml2 (2.9.14-r1)
(4/4) Installing php81 (8.1.9-r0)
Executing busybox-1.35.0-r13.trigger
dbkuaizi-alpine:~# php81 -v
PHP 8.1.9 (cli) (built: Aug  5 2022 23:55:41) (NTS)
Copyright (c) The PHP Group
Zend Engine v4.1.9, Copyright (c) Zend Technologies