apk

Alpine Linux 下的包管理工具

使用实例

1apk install xxx
2apk search xxx # 支持正则
3apk info xxx # 查看包的详细信息
4apk show # list local package
5# 卸载并删除 包
6apk del openssh openntp vim

升级

upgrade命令升级系统已安装的所以软件包(一般包括内核),当然也可指定仅升级部分软件包(通过-u或–upgrade选择指定)。

1apk update # 更新最新本地镜像源
2apk upgrade # 升级软件
3apk add --upgrade busybox # 指定升级部分软件包

搜索

1apk search # 查找所以可用软件包
2apk search -v # 查找所以可用软件包及其描述内容
3apk search -v 'acf*' # 通过软件包名称查找软件包
4apk search -v -d 'docker' # 通过描述文件查找特定的软件包

查看包信息

info命令用于显示软件包的信息。

1apk info # 列出所有已安装的软件包
2apk info -a zlib # 显示完整的软件包信息
3apk info --who-owns /sbin/lbu # 显示指定文件属于的包

笔记

还是蛮喜欢 alpine 的,简单纯粹

 1apk add iproute2 # ss vs netstat
 2ss -ptl
 3apk add drill # drill vs nslookup&dig
 4
 5crond # 开启 cron 服务
 6crontab -l -e
 7
 8apk add xxx
 9apk search -v xxx
10apk info -a xxx
11apk info
12echo -e "http://mirrors.aliyun.com/alpine/v3.6/main\nhttp://mirrors.aliyun.com/alpine/v3.6/community" > /etc/apk/repositories
13apk update
14
15# storage
16ibu # alpine local backup
17
18# network
19echo "shortname" > /etc/hostname
20hostname -F /etc/hostname
21/etc/hosts
22/etc/resolv.conf # conig DNS
23modprobe ipv6 # enable ipv6
24echo "ipv6" >> /etc/modules
25iface # config interface
26apk add iptables ip6tables iptables-doc
27/etc/init.d/networking restart # activate change
28apke add iputils # IPv6 traceroute
29traceroute6 ipv6.google.com
30awall # alpine wall
31# setup a openvpn server
32
33# post-install
34/etc/apk/repositories
35apk add cherokee --update-cache --repository http://dl-3.alpinelinux.org/alpine/edge/testing/ --allow-untrusted
36apk search -v --description 'NTP' # show description and search from description
37apk info -a zlib
38apk info -vv|sort
39apk info -r -R # require / depency
40apk version -v -l '<' # show available updates
41apk upgrade -U -a
42apk add -u xxx # update xxx
43
44/etc/runlevels # runlevel
45apk add openrc # use openrc for init system
46rc-update add xxx # set to start on
47rc-service xxx start # equal -> /etc/init.d/xxx start
48rc-status
49
50adduser xxx
51passwd xxx
52
53apk add ansible # server
54ssh-keygen
55/etc/ansible/hosts
56apk add python # node
57ssh-copy-id
58
59apk add man man-pages mdocml-apropos less less-doc
60export PAGER=less
61/etc/rc.conf # /etc/rc.conf -> funny character
62apk add bash bash-doc bash-completion # bash
63apk add util-linux pciutils usbutils coreutils binutils findutils grep # grep / awk
64apk add build-base gcc abuild binutils binutils-doc gcc-doc # compile
65apk add cmake cmake-doc extra-cmake-modules extra-cmake-modules-doc
66apk add ccache ccache-doc
67
68apk add docker # docker
69rc-update add docker boot
70rc-service docker start
71apk add py-pip
72pip install docker-compose
73ln -s /usr/bin/docker-compose /usr/bin/doc
74
75# application
76apk add openssh # ssh
77rc-update add sshd
78/etc/init.d/sshd start
79/etc/sshd_config
80apk add dropbear # another openssh implementation
81```[来源](https://github.com/jaywcjlove/linux-command):https://github.com/jaywcjlove/linux-command
最后修改于: Wednesday, January 31, 2024
欢迎关注微信公众号,留言交流。

相关文章:

翻译: