Skip to content

Linux Alpine相关

Kervin edited this page Jul 5, 2021 · 10 revisions

一、系统

1.源镜像配置

Alpine Linux 是一个面向安全,轻量级的基于musl libc与busybox项目的Linux发行版。

查看系统版本
cat /etc/alpine-release

输出

alpine:~# uname -a
Linux alpine 5.10.43-0-lts #1-Alpine SMP Fri, 11 Jun 2021 07:41:12 +0000 x86_64 Linux
alpine:~# cat /etc/alpine-release
3.14.0
vim /etc/apk/repositories

v3.12

http://mirrors.tuna.tsinghua.edu.cn/alpine/v3.12/main/
http://mirrors.tuna.tsinghua.edu.cn/alpine/v3.12/community/
http://mirrors.aliyun.com/alpine/v3.12/main/
http://mirrors.aliyun.com/alpine/v3.12/community/
http://mirrors.cloud.tencent.com/alpine/v3.12/main/
http://mirrors.cloud.tencent.com/alpine/v3.12/community/

v3.13

http://mirrors.tuna.tsinghua.edu.cn/alpine/v3.13/main/
http://mirrors.tuna.tsinghua.edu.cn/alpine/v3.13/community/
http://mirrors.aliyun.com/alpine/v3.13/main/
http://mirrors.aliyun.com/alpine/v3.13/community/
http://mirrors.cloud.tencent.com/alpine/v3.13/main/
http://mirrors.cloud.tencent.com/alpine/v3.13/community/

v3.14

http://mirrors.tuna.tsinghua.edu.cn/alpine/v3.14/main/
http://mirrors.tuna.tsinghua.edu.cn/alpine/v3.14/community/
http://mirrors.aliyun.com/alpine/v3.14/main/
http://mirrors.aliyun.com/alpine/v3.14/community/
http://mirrors.cloud.tencent.com/alpine/v3.14/main/
http://mirrors.cloud.tencent.com/alpine/v3.14/community/

2.软件更新/系统全部更新

rm -rf /var/cache/apk/
rm -rf /var/lib/apk/
rm -rf /etc/apk/cache
apk update && apk upgrade

系统搜索

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

卸载软件

apk del --purge xxx

系统升级

apk add --upgrade  --no-cache  --allow-untrusted busybox 

3.通用插件

  • 常用插件
apk add --no-cache net-tools sysstat htop glances zip gzip curl ca-certificates mercurial dos2unix nfs-utils libnfsidmap libnfs-dev
  • JDK安装
apk add --no-cache openjdk8 gedit

6.Docker升级

service docker stop
apk del --purge -f docker
rm -rf /usr/share/bash-completion/completions/docker
rm -rf /usr/bin/docker*
rm -rf /usr/libexec/docker
rm -rf /etc/init.d/docker
rm -rf /etc/default/docker
rm -rf /etc/init/docker.conf
rm -rf /run/docker.sock
rm -rf /var/lib/docker
rm -rf /etc/docker
rm -rf /var/lib/systemd/deb-systemd-helper-enabled/*/docker*
rm -rf /var/lib/systemd/deb-systemd-helper-enabled/docker*
rm -rf /var/crash/docker*
rm -rf /var/cache/apt/archives/docker*
rm -rf /usr/share/doc/docker*
rm -rf /usr/share/fish/vendor_completions.d/docker.fish
rm -rf /usr/share/man/*/docker*
rm -rf /usr/lib/systemd/system/docker*
chattr -R -i /sys/fs/cgroup/*/*/docker*/*
rm -rf /sys/fs/cgroup/*/*/docker*
rm -rf /etc/systemd/system/*/docker*
rm -rf /var/lib/systemd/deb-systemd-helper-enabled/*/containerd*
rm -rf /var/lib/systemd/deb-systemd-helper-enabled/containerd*
rm -rf /var/lib/containerd
rm -rf /usr/share/doc/containerd*
rm -rf /usr/share/man/*/containerd*
rm -rf /usr/bin/containerd*
rm -rf /usr/lib/systemd/system/containerd*
rm -rf /etc/systemd/system/*/containerd*
rm -rf /etc/containerd
rm -rf /run/containerd
rm -rf /opt/containerd
# find / -name docker*

apk update
apk add --no-cache --allow-untrusted docker
rc-update add docker boot
service docker start
docker version

二、第三方软件

1.FTP安装

apk add --no-cache --allow-untrusted vsftpd

修改配置(/etc/vsftpd.conf)

#允许匿名访问
anonymous_enable=YES
#匿名目录
anon_root=/data/logs
no_anon_password=YES

重启服务

#/etc/init.d/vsftpd restart
systemctl restart vsftpd
systemctl status vsftpd

访问服务: ftp://127.0.0.1