RUN sed -i s@/deb.debian.org/@/mirrors.aliyun.com/@g /etc/apt/sources.list \
&& sed -i "s@/security.debian.org@/mirrors.aliyun.com@g" /etc/apt/sources.list \
&& mv /etc/localtime /etc/localtime_bak \
&& cp /usr/share/zoneinfo/Asia/Shanghai /etc/localtime \
&& echo "Asia/Shanghai" > /etc/timezone
sed -i "s@/deb.debian.org@/mirrors.aliyun.com@g" /etc/apt/sources.list
sed -i "s@/security.debian.org@/mirrors.aliyun.com@g" /etc/apt/sources.list
apt-get clean
apt-get update
cat <<EOF >/etc/apt/sources.list
deb http://mirrors.cloud.aliyuncs.com/debian/ bullseye main contrib non-free
deb http://mirrors.cloud.aliyuncs.com/debian/ bullseye-updates main contrib non-free
deb http://mirrors.cloud.aliyuncs.com/debian/ bullseye-proposed-updates main non-free contrib
deb http://mirrors.cloud.aliyuncs.com/debian/ bullseye-backports main non-free contrib
deb-src http://mirrors.cloud.aliyuncs.com/debian/ bullseye-updates main contrib non-free
deb-src http://mirrors.cloud.aliyuncs.com/debian/ bullseye main contrib non-free
deb-src http://mirrors.cloud.aliyuncs.com/debian/ bullseye-proposed-updates main contrib non-free
deb-src http://mirrors.cloud.aliyuncs.com/debian/ bullseye-backports main contrib non-free
deb http://mirrors.cloud.aliyuncs.com/debian-security/ bullseye-security main non-free contrib
deb-src http://mirrors.cloud.aliyuncs.com/debian-security/ bullseye-security main non-free contrib
EOF
#12
sed -i 's|deb.debian.org|mirrors.aliyun.com|g' /etc/apt/sources.list.d/debian.sources
https://mirrors.cloud.tencent.com/
debian11参考 【腾讯云的服务器已换源不需要换】
https://blog.csdn.net/w946612410/article/details/125145368
sed -i "s@/deb.debian.org@/mirrors.tencentyun.com@g" /etc/apt/sources.list
sed -i "s@/security.debian.org@/mirrors.tencentyun.com@g" /etc/apt/sources.list
阿里改腾讯云
sed -i "s@/mirrors.aliyun.com@/mirrors.tencentyun.com@g" /etc/apt/sources.list
http://换https
sed -i "s@http://mirrors.tencentyun.com@https://mirrors.tencentyun.com@g" /etc/apt/sources.list
https
sed -i "s@https://mirrors.tencentyun.com@https://mirrors.cloud.tencent.com@g" /etc/apt/sources.list
cat <<EOF >/etc/apt/sources.list
deb http://mirrors.tencentyun.com/debian/ bullseye main non-free contrib
deb-src http://mirrors.tencentyun.com/debian/ bullseye main non-free contrib
deb http://mirrors.tencentyun.com/debian-security/ bullseye-security main
deb-src http://mirrors.tencentyun.com/debian-security/ bullseye-security main
deb http://mirrors.tencentyun.com/debian/ bullseye-updates main non-free contrib
deb-src http://mirrors.tencentyun.com/debian/ bullseye-updates main non-free contrib
deb http://mirrors.tencentyun.com/debian/ bullseye-backports main non-free contrib
deb-src http://mirrors.tencentyun.com/debian/ bullseye-backports main non-free contrib
EOF
https://mirror.tuna.tsinghua.edu.cn/help/debian/
如果遇到无法拉取 https 源的情况,请先使用 http 源并安装:
apt install -y sudo apt-transport-https ca-certificates
sed -i "s@/deb.debian.org@/mirrors.tuna.tsinghua.edu.cn@g" /etc/apt/sources.list
sed -i "s@/security.debian.org@/mirrors.tuna.tsinghua.edu.cn@g" /etc/apt/sources.list
cat <<EOF >/etc/apt/sources.list
deb https://mirrors.tuna.tsinghua.edu.cn/debian/ bullseye main contrib non-free
deb https://mirrors.tuna.tsinghua.edu.cn/debian/ bullseye-updates main contrib non-free
deb https://mirrors.tuna.tsinghua.edu.cn/debian/ bullseye-backports main contrib non-free
deb https://mirrors.tuna.tsinghua.edu.cn/debian-security bullseye-security main contrib non-free
EOF
/etc/apt/sources.list
#debian11
sed -i 's/deb.debian.org/mirrors.ustc.edu.cn/g' /etc/apt/sources.list
sed -i 's|security.debian.org/debian-security|mirrors.ustc.edu.cn/debian-security|g'
#debian12换源命令
sed -i 's/deb.debian.org/mirrors.ustc.edu.cn/g' /etc/apt/sources.list.d/debian.sources
#说明
http://mirrors.ustc.edu.cn/help/debian.html