原理:
根据清华源提供的Ubuntu 软件仓库进行sources.list替换
ubuntu | 镜像站使用帮助 | 清华大学开源软件镜像站 | Tsinghua Open Source Mirror
1、换源
echo "">/etc/apt/sources.list \
&& echo "# 默认注释了源码镜像以提高 apt update 速度,如有需要可自行取消注释">>/etc/apt/sources.list \
&& echo "deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ jammy main restricted universe multiverse">>/etc/apt/sources.list \
&& echo "# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ jammy main restricted universe multiverse">>/etc/apt/sources.list \
&& echo "deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ jammy-updates main restricted universe multiverse">>/etc/apt/sources.list \
&& echo "# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ jammy-updates main restricted universe multiverse">>/etc/apt/sources.list \
&& echo "deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ jammy-backports main restricted universe multiverse">>/etc/apt/sources.list \
&& echo "# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ jammy-backports main restricted universe multiverse">>/etc/apt/sources.list \
&& echo "deb http://security.ubuntu.com/ubuntu/ jammy-security main restricted universe multiverse">>/etc/apt/sources.list \
&& echo "# deb-src http://security.ubuntu.com/ubuntu/ jammy-security main restricted universe multiverse">>/etc/apt/sources.list \
&& echo "# 预发布软件源,不建议启用">>/etc/apt/sources.list \
&& echo "# deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ jammy-proposed main restricted universe multiverse">>/etc/apt/sources.list \
&& echo "# # deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ jammy-proposed main restricted universe multiverse">>/etc/apt/sources.list
2、更新软件列表
apt-get clean && apt-get update