您现在的位置是: 首页 > 运维 Debian apt 使用国内镜像

Debian apt 使用国内镜像

2020-05-20 运维 8186人已围观 16976次浏览

简介Debian apt 使用国内镜像

首先是要找到适合自己当前版本的镜像配置

我这里是用的清华大学开源软件镜像站

如果不知道当前对应的 Debian 版本,可以通过查看默认的 apt 源来判断版本

cat /etc/apt/sources.list

返回内容如下

deb http://deb.debian.org/debian buster main
deb http://deb.debian.org/debian buster-updates main
deb http://security.debian.org/debian-security/ buster/updates main
deb http://ftp.debian.org/debian buster-backports main

可以发现 Debian 版本为 buster ,所以直接选择版本为 buster 即可

因为默认的源是 http 的,但是准备使用的镜像源是 https 的,所以需要额外的安装有关 HTTPS 的包

官网要求的是安装

sudo apt install apt-transport-https

实际上只安装这一个是不够的,会提示下面的报错

Certificate verification failed: The certificate is NOT trusted. The certificate issuer is unknown. Could not handshake: Error in the certificate verification.
No system certificates available. Try installing ca-certificates.

根据报错和提示信息,发现还需要继续安装 ca-certificates

sudo apt install ca-certificates

以上的包先提前安装,然后备份原始的源的文件,或者是注释掉原有的源,然后在下面新增镜像源,比如

#deb http://deb.debian.org/debian buster main
#deb http://deb.debian.org/debian buster-updates main
#deb http://security.debian.org/debian-security/ buster/updates main
#deb http://ftp.debian.org/debian buster-backports main

deb 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 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

保存退出,最后更新源,使配置生效

sudo apt update

等待验证,通过后,可以尝试安装之前比较慢的包,试试看效果,可以发现速度有质的提升

很赞哦! (0)

站长推荐

站点信息

  • 网站地图