国内机器一般需要先更换apt源才能系统更新。本文提供两种方法。
更换为国内源
编辑/etc/apt/sources.list文件,删除默认的放入下面内容
deb https://mirrors.aliyun.com/debian/ bullseye main non-free contrib
deb-src https://mirrors.aliyun.com/debian/ bullseye main non-free contrib
deb https://mirrors.aliyun.com/debian-security/ bullseye-security main
deb-src https://mirrors.aliyun.com/debian-security/ bullseye-security main
deb https://mirrors.aliyun.com/debian/ bullseye-updates main non-free contrib
deb-src https://mirrors.aliyun.com/debian/ bullseye-updates main non-free contrib
deb https://mirrors.aliyun.com/debian/ bullseye-backports main non-free contrib
deb-src https://mirrors.aliyun.com/debian/ bullseye-backports main non-free contrib
使用代理
在 /etc/apt/apt.conf.d 目录下创建一个新文件
touch /etc/apt/apt.conf.d/proxy.conf
proxy.conf内容如下,代理设置参考:https://012456.xyz/ldn/linux-proxy/
Acquire {
HTTP::proxy "http://127.0.0.1:8080";
HTTPS::proxy "http://127.0.0.1:8080";
}
参考链接:如何在linux上设置APT代理