确定当前Debian系统的版本

在Debian输入cat /etc/os-release查看当前Debian系统的版本

$ cat /etc/os-release
PRETTY_NAME="Debian GNU/Linux 10 (buster)"
NAME="Debian GNU/Linux"
VERSION_ID="10"
VERSION="10 (buster)"
VERSION_CODENAME=buster
ID=debian
HOME_URL="https://www.debian.org/"
SUPPORT_URL="https://www.debian.org/support"
BUG_REPORT_URL="https://bugs.debian.org/"

此处是Debian GNU/Linux 10 (buster)


在清华源找到对应的软件源镜像

可以直接点击Debian右侧的❓进入Debian镜像使用帮助

1a068f7c2e79d4cc5e9720fdc690d8a1.png

如图也可以在清华源镜像站右下角找到使用帮助 然后再找到Debian的使用帮助

94f90c2d9f21e1785d020d5c27e76ad8.png

191d114d5911f3965f7fb3501a5f73da.png

备份并更换清华源

使用命令sudo mv /etc/apt/sources.list /etc/apt/sources.list.back/etc/apt/sources.list重命名为/etc/apt/sources.list.back实现备份

$ mv /etc/apt/sources.list /etc/apt/sources.list.back

sudo nano /etc/apt/sources.list写入清华源

# 默认注释了源码镜像以提高 apt update 速度,如有需要可自行取消注释
deb https://mirrors.tuna.tsinghua.edu.cn/debian/ buster main contrib non-free
# deb-src https://mirrors.tuna.tsinghua.edu.cn/debian/ buster main contrib non-free
deb https://mirrors.tuna.tsinghua.edu.cn/debian/ buster-updates main contrib non-free
# deb-src https://mirrors.tuna.tsinghua.edu.cn/debian/ buster-updates main contrib non-free
deb https://mirrors.tuna.tsinghua.edu.cn/debian/ buster-backports main contrib non-free
# deb-src https://mirrors.tuna.tsinghua.edu.cn/debian/ buster-backports main contrib non-free
deb https://mirrors.tuna.tsinghua.edu.cn/debian-security buster/updates main contrib non-free
# deb-src https://mirrors.tuna.tsinghua.edu.cn/debian-security buster/updates main contrib non-free

进行update更新 发现报错

$ sudo apt update
Ign:1 https://mirrors.tuna.tsinghua.edu.cn/debian buster InRelease
Ign:2 https://mirrors.tuna.tsinghua.edu.cn/debian buster-updates InRelease
Ign:3 https://mirrors.tuna.tsinghua.edu.cn/debian buster-backports InRelease
Ign:4 https://mirrors.tuna.tsinghua.edu.cn/debian-security buster/updates InRelease
Err:5 https://mirrors.tuna.tsinghua.edu.cn/debian buster Release
  Certificate verification failed: The certificate is NOT trusted. The certificate issuer is unknown.  Could not handshake: Error in the certificate verification. [IP: 101.6.8.193 443]

...

E: The repository 'https://mirrors.tuna.tsinghua.edu.cn/debian-security buster/updates Release' does not have a Release file.
N: Updating from such a repository can't be done securely, and is therefore disabled by default.
N: See apt-secure(8) manpage for repository creation and user configuration details.

可以在清华源Debian使用帮助中发现

如果遇到无法拉取 https 源的情况,请先使用 http 源并安装: $ sudo apt install apt-transport-https ca-certificates

这里直接将/etc/apt/sources.list中的https改为http,然后先sudo apt update再使用执行清华源Debian使用帮助中的命令,再改回https即可

Logo

更多推荐