配置Alpine源镜像

通过uname -acat /etc/issue,确认系统信息;

960ddd5f80cc:/# uname -a
Linux 960ddd5f80cc 4.4.302+ #64570 SMP Tue Jun 13 21:40:17 CST 2023 x86_64 Linux
960ddd5f80cc:/# cat /etc/issue
Welcome to Alpine Linux 3.17
Kernel \r on an \m (\l)

备份配置repositories文件;

960ddd5f80cc:/# cp -a /etc/apk/repositories /etc/apk/repositories.bak
960ddd5f80cc:/# cd /etc/apk/
960ddd5f80cc:/etc/apk# ls
arch               keys               protected_paths.d  repositories       repositories.bak   world

修改repositories文件,

将https://dl-cdn.alpinelinux.org/替换成https://mirrors.huaweicloud.com/,可以参考如下命令sed -i "s@https://dl-cdn.alpinelinux.org/@https://mirrors.huaweicloud.com/@g" /etc/apk/repositories或者直接注释原来的地址,再添加新镜像域名的地址;

960ddd5f80cc:/etc/apk# vi repositories
960ddd5f80cc:/etc/apk# cat repositories
# https://dl-cdn.alpinelinux.org/alpine/v3.17/main
# https://dl-cdn.alpinelinux.org/alpine/v3.17/community
https://repo.huaweicloud.com/alpine/v3.17/main
https://repo.huaweicloud.com/alpine/v3.17/community

执行apk update更新索引,执行apk search xxx查询软件包,执行apk install xxx安装软件包`

参考资料

华为开源镜像站_Alpine 使用说明 https://mirrors.huaweicloud.com/mirrorDetail/5ea14e7b02ea0eda6bd1e8fa

posted on 2023-11-12 20:43  cxloge  阅读(546)  评论(0编辑  收藏  举报