目标
公司容器使用的系统为 Debian,在里面安装软件时特别慢,需要先换源再安装软件最后使用
版本
Debian 12 之后软件源配置文件为 DEB822 格式,路径为 /etc/apt/sources.list.d/debian.sources
之前使用传统的 One-Line-Style,路径为 /etc/apt/sources.list
所以先查看 Debian 版本,以下任意命令均可:
cat /etc/debian_version
cat /etc/issue
cat /etc/os-release
uname -a --这个其实不行,看不出版本来。。。
最后确认系统是 Debian 12.6
换源
因为系统是 Debian 12.6,所以取源中 DEB822 格式的配置,然后写入对应文件即可
清华源:
Types: deb
URIs: https://mirrors.tuna.tsinghua.edu.cn/debian
Suites: bookworm bookworm-updates bookworm-backports
Components: main contrib non-free non-free-firmware
Signed-By: /usr/share/keyrings/debian-archive-keyring.gpg
# 默认注释了源码镜像以提高 apt update 速度,如有需要可自行取消注释
# Types: deb-src
# URIs: https://mirrors.tuna.tsinghua.edu.cn/debian
# Suites: bookworm bookworm-updates bookworm-backports
# Components: main contrib non-free non-free-firmware
# Signed-By: /usr/share/keyrings/debian-archive-keyring.gpg
# 以下安全更新软件源包含了官方源与镜像站配置,如有需要可自行修改注释切换
Types: deb
URIs: https://security.debian.org/debian-security
Suites: bookworm-security
Components: main contrib non-free non-free-firmware
Signed-By: /usr/share/keyrings/debian-archive-keyring.gpg
# Types: deb-src
# URIs: https://security.debian.org/debian-security
# Suites: bookworm-security
# Components: main contrib non-free non-free-firmware
# Signed-By: /usr/share/keyrings/debian-archive-keyring.gpg
中科大源:
Types: deb
URIs: http://mirrors.ustc.edu.cn/debian
Suites: bookworm bookworm-updates
Components: main contrib non-free non-free-firmware
Signed-By: /usr/share/keyrings/debian-archive-keyring.gpg
Types: deb
URIs: http://mirrors.ustc.edu.cn/debian-security
Suites: bookworm-security
Components: main contrib non-free non-free-firmware
Signed-By: /usr/share/keyrings/debian-archive-keyring.gpg
使用
apt update -- 更新软件包索引
apt upgrade -- 升级已安装的软件包(这个可以不执行)
apt install iputils-ping
apt install telnet
apt install curl
curl -X POST -H "Content-Type: application/json" -d '{"key1":"value1", "key2":"value2"}' http://example.com/data