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
相关推荐
Jason_zhao_MR8 分钟前
米尔MYD-JR3576开发板 Android 15系统正式发布
android·linux·嵌入式硬件·嵌入式
水饺编程32 分钟前
第1章,本专栏新增的可自由修改的 Linux 0.12 内核
linux·c语言·汇编
我命由我123451 小时前
Android 广播 - Android 开机广播实现开机自启应用
android·java·linux·java-ee·kotlin·android studio·android-studio
沫璃染墨2 小时前
从零入门计算机网络系列(三十一):Linux I/O 多路复用详解——select 工作原理与底层机制
linux·运维·服务器·网络·c++·网络协议·信息与通信
沫璃染墨2 小时前
从零入门计算机网络系列(三十二):Linux I/O 多路复用详解——poll 工作原理、TCP 实战与性能瓶颈
linux·运维·服务器·网络·c++·网络协议·网络安全
是专家不是砖家2 小时前
pthread_mutex_t 踩内存引起的总线错误问题
linux·内存对齐·pthread_mutex_t·1字节对齐
Android系统攻城狮2 小时前
FFmpeg深度解析之av_frame_get_buffer:如何为AVFrame分配缓冲区?(八十四)
linux·ffmpeg·音视频·车载音频·ffmpeg音视频进阶
大袁同学2 小时前
【Linux网络编程】:破局孤岛通四海,纵贯五层渡风云
linux·网络·c++·后端
独隅3 小时前
RustRover 在 Linux 环境下的安装部署与高效开发实战
linux·运维·服务器·jetbrains·rustrover
老一岁3 小时前
MySQL事务与视图详解
linux·数据库·mysql