debain系统更新软件源

国内用户在使用Debian系统时,使用官方的源进行更新的时候速度很慢,可通过更换国内镜像源(阿里云、清华大学、中科大),提升下载速度。

备份原始源文件

cpp 复制代码
cd /etc/apt
cp sources.list sources.list.bak

阿里云镜像源

cpp 复制代码
deb https://mirrors.aliyun.com/debian/ bookworm main non-free non-free-firmware contrib
deb-src https://mirrors.aliyun.com/debian/ bookworm main non-free non-free-firmware contrib
deb https://mirrors.aliyun.com/debian-security/ bookworm-security main
deb-src https://mirrors.aliyun.com/debian-security/ bookworm-security main
deb https://mirrors.aliyun.com/debian/ bookworm-updates main non-free non-free-firmware contrib
deb-src https://mirrors.aliyun.com/debian/ bookworm-updates main non-free non-free-firmware contrib
deb https://mirrors.aliyun.com/debian/ bookworm-backports main non-free non-free-firmware contrib
deb-src https://mirrors.aliyun.com/debian/ bookworm-backports main non-free non-free-firmware contrib

清华大学镜像源

cpp 复制代码
deb https://mirrors.tuna.tsinghua.edu.cn/debian/ bookworm main contrib non-free non-free-firmware
deb-src https://mirrors.tuna.tsinghua.edu.cn/debian/ bookworm main contrib non-free non-free-firmware
deb https://mirrors.tuna.tsinghua.edu.cn/debian-security bookworm-security main contrib non-free non-free-firmware
deb-src https://mirrors.tuna.tsinghua.edu.cn/debian-security bookworm-security main contrib non-free non-free-firmware
deb https://mirrors.tuna.tsinghua.edu.cn/debian/ bookworm-updates main contrib non-free non-free-firmware
deb-src https://mirrors.tuna.tsinghua.edu.cn/debian/ bookworm-updates main contrib non-free non-free-firmware
deb https://mirrors.tuna.tsinghua.edu.cn/debian/ bookworm-backports main contrib non-free non-free-firmware
deb-src https://mirrors.tuna.tsinghua.edu.cn/debian/ bookworm-backports main contrib non-free non-free-firmware

中科大镜像源

cpp 复制代码
deb https://mirrors.ustc.edu.cn/debian/ bookworm main contrib non-free non-free-firmware
deb-src https://mirrors.ustc.edu.cn/debian/ bookworm main contrib non-free non-free-firmware
deb https://mirrors.ustc.edu.cn/debian-security bookworm-security main contrib non-free non-free-firmware
deb-src https://mirrors.ustc.edu.cn/debian-security bookworm-security main contrib non-free non-free-firmware

保存文件后,执行以下命令,更新软件包

cpp 复制代码
sudo apt update && sudo apt upgrade -y

注意版本匹配的问题

将配置中的 bookworm 替换为实际Debian版本代号(如Debian 11为 bullseye),可通过以下命令查询

cpp 复制代码
lsb_release -a

使用sudo apt update命令,进行系统软件更新的时候,若是遇到更新失败的问题,可检查一下nameserver的配置项。

在linux系统中,nameserver 是一个配置项,用于指定DNS服务器的IP 地址。nameserver 行告诉系统应该使用哪些 DNS 服务器来解析域名。

编辑/etc/resolv.conf的文件,以本机的系统为例,内网的ip是192.168.0.102,resolv.conf的内容如下:

cpp 复制代码
nameserver 192.168.0.1
相关推荐
如意.7595 小时前
【Linux开发工具实战】Git、GDB与CGDB从入门到精通
linux·运维·git
Thera7776 小时前
C++ 高性能时间轮定时器:从单例设计到 Linux timerfd 深度优化
linux·开发语言·c++
爱吃土豆的马铃薯ㅤㅤㅤㅤㅤㅤㅤㅤㅤ7 小时前
Linux 查询某进程文件所在路径 命令
linux·运维·服务器
安当加密8 小时前
无需改 PAM!轻量级 RADIUS + ASP身份认证系统 实现 Linux 登录双因子认证
linux·运维·服务器
内卷焦虑人士9 小时前
Windows安装WSL2+Ubuntu 22.04
linux·windows·ubuntu
dddddppppp12310 小时前
qemu模拟的一个内核驱动 io口中断
linux
程序员老赵10 小时前
超全 Docker 镜像源配置指南|Windows/Mac/Linux一键搞定,拉镜像再也不卡顿
linux·后端·容器
门豪杰11 小时前
Ubuntu下安装Claude Code
linux·运维·ubuntu·claude·claude code
总要冲动一次11 小时前
离线安装 percona-xtrabackup-24
linux·数据库·mysql·centos
桌面运维家11 小时前
Windows/Linux双启动:BIOS/UEFI多配置桌面创建指南
linux·运维·windows