apk - Alpine Linux 下的包管理工具

使用实例

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

升级

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

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

搜索

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

查看包信息

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

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

笔记

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

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