1 | apk
|
2 | ===
|
3 |
|
4 | Alpine Linux 下的包管理工具
|
5 |
|
6 | ## 使用实例
|
7 |
|
8 | ```shell
|
9 | apk install xxx
|
10 | apk search xxx # 支持正则
|
11 | apk info xxx # 查看包的详细信息
|
12 | apk show # list local package
|
13 | # 卸载并删除 包
|
14 | apk del openssh openntp vim
|
15 | ```
|
16 |
|
17 | ### 升级
|
18 |
|
19 | upgrade命令升级系统已安装的所以软件包(一般包括内核),当然也可指定仅升级部分软件包(通过-u或–upgrade选择指定)。
|
20 |
|
21 | ```shell
|
22 | apk update # 更新最新本地镜像源
|
23 | apk upgrade # 升级软件
|
24 | apk add --upgrade busybox # 指定升级部分软件包
|
25 | ```
|
26 |
|
27 | ### 搜索
|
28 |
|
29 | ```shell
|
30 | apk search # 查找所以可用软件包
|
31 | apk search -v # 查找所以可用软件包及其描述内容
|
32 | apk search -v 'acf*' # 通过软件包名称查找软件包
|
33 | apk search -v -d 'docker' # 通过描述文件查找特定的软件包
|
34 | ```
|
35 |
|
36 | ### 查看包信息
|
37 |
|
38 | info命令用于显示软件包的信息。
|
39 |
|
40 | ```shell
|
41 | apk info # 列出所有已安装的软件包
|
42 | apk info -a zlib # 显示完整的软件包信息
|
43 | apk info --who-owns /sbin/lbu # 显示指定文件属于的包
|
44 | ```
|
45 |
|
46 | ## 笔记
|
47 |
|
48 | 还是蛮喜欢 alpine 的,简单纯粹
|
49 |
|
50 | ```shell
|
51 | apk add iproute2 # ss vs netstat
|
52 | ss -ptl
|
53 | apk add drill # drill vs nslookup&dig
|
54 |
|
55 | crond # 开启 cron 服务
|
56 | crontab -l -e
|
57 |
|
58 | apk add xxx
|
59 | apk search -v xxx
|
60 | apk info -a xxx
|
61 | apk info
|
62 | echo -e "http://mirrors.aliyun.com/alpine/v3.6/main\nhttp://mirrors.aliyun.com/alpine/v3.6/community" > /etc/apk/repositories
|
63 | apk update
|
64 |
|
65 | # storage
|
66 | ibu # alpine local backup
|
67 |
|
68 | # network
|
69 | echo "shortname" > /etc/hostname
|
70 | hostname -F /etc/hostname
|
71 | /etc/hosts
|
72 | /etc/resolv.conf # conig DNS
|
73 | modprobe ipv6 # enable ipv6
|
74 | echo "ipv6" >> /etc/modules
|
75 | iface # config interface
|
76 | apk add iptables ip6tables iptables-doc
|
77 | /etc/init.d/networking restart # activate change
|
78 | apke add iputils # IPv6 traceroute
|
79 | traceroute6 ipv6.google.com
|
80 | awall # alpine wall
|
81 | # setup a openvpn server
|
82 |
|
83 | # post-install
|
84 | /etc/apk/repositories
|
85 | apk add cherokee --update-cache --repository http://dl-3.alpinelinux.org/alpine/edge/testing/ --allow-untrusted
|
86 | apk search -v --description 'NTP' # show description and search from description
|
87 | apk info -a zlib
|
88 | apk info -vv|sort
|
89 | apk info -r -R # require / depency
|
90 | apk version -v -l '<' # show available updates
|
91 | apk upgrade -U -a
|
92 | apk add -u xxx # update xxx
|
93 |
|
94 | /etc/runlevels # runlevel
|
95 | apk add openrc # use openrc for init system
|
96 | rc-update add xxx # set to start on
|
97 | rc-service xxx start # equal -> /etc/init.d/xxx start
|
98 | rc-status
|
99 |
|
100 | adduser xxx
|
101 | passwd xxx
|
102 |
|
103 | apk add ansible # server
|
104 | ssh-keygen
|
105 | /etc/ansible/hosts
|
106 | apk add python # node
|
107 | ssh-copy-id
|
108 |
|
109 | apk add man man-pages mdocml-apropos less less-doc
|
110 | export PAGER=less
|
111 | /etc/rc.conf # /etc/rc.conf -> funny character
|
112 | apk add bash bash-doc bash-completion # bash
|
113 | apk add util-linux pciutils usbutils coreutils binutils findutils grep # grep / awk
|
114 | apk add build-base gcc abuild binutils binutils-doc gcc-doc # compile
|
115 | apk add cmake cmake-doc extra-cmake-modules extra-cmake-modules-doc
|
116 | apk add ccache ccache-doc
|
117 |
|
118 | apk add docker # docker
|
119 | rc-update add docker boot
|
120 | rc-service docker start
|
121 | apk add py-pip
|
122 | pip install docker-compose
|
123 | ln -s /usr/bin/docker-compose /usr/bin/doc
|
124 |
|
125 | # application
|
126 | apk add openssh # ssh
|
127 | rc-update add sshd
|
128 | /etc/init.d/sshd start
|
129 | /etc/sshd_config
|
130 | apk add dropbear # another openssh implementation
|
131 | ``` |
\ | No newline at end of file |