当前软件源/etc/apt/sources.list配置
deb http://ftp.us.debian.org/debian/ bookworm main non-free non-free-firmware contrib
deb-src http://ftp.us.debian.org/debian/ bookworm main non-free non-free-firmware contrib
deb http://ftp.us.debian.org/debian/ bookworm-updates main non-free non-free-firmware contrib
deb-src http://ftp.us.debian.org/debian/ bookworm-updates main non-free non-free-firmware contrib
deb http://ftp.us.debian.org/debian/ bookworm-backports main non-free non-free-firmware contrib
deb-src http://ftp.us.debian.org/debian/ bookworm-backports main non-free non-free-firmware contrib当前使用的是美国FTP服务器源,可能下载速度较慢。
推荐替换命令:
阿里云镜像源
sudo sed -i 's/ftp.us.debian.org/mirrors.aliyun.com/g' /etc/apt/sources.list具体解释:
sudo - 以管理员权限执行命令
sed -i - 使用 sed 文本处理工具直接修改文件内容
's/deb.debian.org/mmirrors.aliyun.com/g' - 替换规则:
s/ - 开始替换操作
deb.debian.org - 要被替换的原始域名(Debian 官方源)
mirrors.aliyun.com - 替换成的新域名(阿里云镜像源)
g - 全局替换(文件中所有匹配项都替换)
/etc/apt/sources.list - 要修改的文件(软件源配置文件)清华大学镜像源
sudo sed -i 's/ftp.us.debian.org/mirrors.tuna.tsinghua.edu.cn/g' /etc/apt/sources.list中国科技大学镜像源
sudo sed -i 's/ftp.us.debian.org/mirrors.ustc.edu.cn/g' /etc/apt/sources.list变成:
deb http://mirrors.tuna.tsinghua.edu.cn/debian/ bookworm main non-free non-free-firmware contrib
deb-src http://mirrors.tuna.tsinghua.edu.cn/debian/ bookworm main non-free non-free-firmware contrib
deb http://mirrors.tuna.tsinghua.edu.cn/debian/ bookworm-updates main non-free non-free-firmware contrib
deb-src http://mirrors.tuna.tsinghua.edu.cn/debian/ bookworm-updates main non-free non-free-firmware contrib
deb http://mirrors.tuna.tsinghua.edu.cn/debian/ bookworm-backports main non-free non-free-firmware contrib
deb-src http://mirrors.tuna.tsinghua.edu.cn/debian/ bookworm-backports main non-free non-free-firmware contrib这样就可以愉快地更新软件包了:
sudo apt update