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
版權申明:
- 未標註來源的內容皆為原創,未經授權請勿轉載(因轉載後排版往往錯亂、內容不可控、無法持續更新等);
- 非營利為目的,演繹本博客任何內容,請以'原文出處'或者'參考鏈接'等方式給出本站相關網頁地址(方便讀者)。