Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Play Alpine linux (2): APK package Manager

2025-02-28 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/02 Report--

Alpine Linux is very compact and takes up 20 to 30 megabytes of boot memory. Without unpacking, we need to do some understanding and configuration by ourselves.

Advantages and disadvantages of Alpine Linux

Alpine Linux's Docker image is lightweight (only 5m in size) and has a complete package management tool (APK).

The official Docker image may replace Ubuntu with Alpine Linux.

Inferior position

Alpine Linux uses musl, which may be a little different from the glibc implementation used by other Linux distributions.

DNS services implemented by musl do not use the search and domain configurations in the resolv.conf file, so you need to be careful when discovering services through DNS.

Package Manager apk package Management Command

Alpine uses apk for package management. Use the apk-- help command to view the complete package management commands. Here are some common commands:

1. Update: update the local mirror source index from the remote mirror source

The update command downloads APKINDEX.tar.gz from each list of image sources and stores it in the local cache, usually under / var/cache/apk/ (where Alpine is located), / var/lib/apk/, / etc/apk/cache/.

$apk update

2. Add: install PACKAGES and automatically resolve dependencies

The add command installs the package from the repository and automatically manages dependencies.

$apk add openssh openntp vim$ apk add-- no-cache mysql-client$ apk add docker-- update-cache-- repository http://mirrors.ustc.edu.cn/alpine/v3.4/main/-- allow-untrusted

Install the specified version of the package

$apk add asterisk=1.6.0.21-r0 $apk add 'asterisk1.6.1'

3. Del: uninstall and delete PACKAGES

$apk del openssh openntp vim

4. Upgrade: upgrade currently installed software packages

The upgrade command upgrades all packages installed on the system (generally including the kernel). Of course, you can also specify that only some packages can be upgraded (specified by-u or-- upgrade option).

$apk update # update the latest local mirror source $apk upgrade # upgrade software $apk add-- upgrade busybox # specify the upgrade part of the package

5. Search: search for software packages

The search command searches for available software packages, the-v parameter outputs the description content, the payout wildcard, and the-d or-description parameter specifies the query through the package description.

$apk search # find all available packages $apk search-v # find all available packages and their descriptions $apk search-v 'acf*' # find packages by package name $apk search-v-d 'docker' # find specific packages through description files

6. The info command is used to display information about the software package.

$apk info # lists all installed packages $apk info-a zlib # displays complete package information $apk info-- who-owns / sbin/lbu # shows the package configuration software source to which the specified file belongs

Take Zhongke Dayuan as an example: add the corresponding source address to the / etc/apk/repositories file, one address per line.

$vi / etc/apk/repositories# / media/cdrom/apks http://mirrors.ustc.edu.cn/alpine/v3.5/mainhttp://mirrors.ustc.edu.cn/alpine/v3.5/community

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report