新的版本已经移除文件 /etc/apt/sources.list,现在使用文件/etc/apt/sources.list.d/debian.sources
文件内容如下:
Types: deb # http://snapshot.debian.org/archive/debian/20250224T000000Z URIs: http://deb.debian.org/debian Suites: bookworm bookworm-updates Components: main Signed-By: /usr/share/keyrings/debian-archive-keyring.gpg Types: deb # http://snapshot.debian.org/archive/debian-security/20250224T000000Z URIs: http://deb.debian.org/debian-security Suites: bookworm-security Components: main Signed-By: /usr/share/keyrings/debian-archive-keyring.gpg
通过sed命令修改为国内源
# 华为云 Huawei Cloud sed -i 's@deb.debian.org@repo.huaweicloud.com@g' /etc/apt/sources.list.d/debian.sources # 阿里云 Aliyun(限速) sed -i 's@deb.debian.org@mirrors.aliyun.com@g' /etc/apt/sources.list.d/debian.sources # 腾讯云 Tencent Cloud(限速) sed -i 's@deb.debian.org@mirrors.cloud.tencent.com@g' /etc/apt/sources.list.d/debian.sources # 清华大学 TSINGHUA TUNA(北京地区推荐) sed -i 's@deb.debian.org@mirrors.tuna.tsinghua.edu.cn@g' /etc/apt/sources.list.d/debian.sources # 中科大 USTC sed -i 's@deb.debian.org@mirrors.ustc.edu.cn@g' /etc/apt/sources.list.d/debian.sources # 南京大学 NJU sed -i 's@deb.debian.org@mirror.nju.edu.cn@g' /etc/apt/sources.list.d/debian.sources # 上海交大 SJTU(上海地区推荐) sed -i 's@deb.debian.org@mirror.sjtu.edu.cn@g' /etc/apt/sources.list.d/debian.sources # 香港 xTom(仅限香港特别行政区) sed -i 's@deb.debian.org@mirror.xtom.com.hk@g' /etc/apt/sources.list.d/debian.sources
下面是旧版本修改方法
:cp /etc/apt/sources.list /etc/apt/sources.list.bak
阿里云源
cat /etc/apt/sources.list << EOF 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 EOF
中科大源
cat /etc/apt/sources.list << EOF deb https://mirrors.ustc.edu.cn/debian/ bookworm main non-free non-free-firmware contrib deb-src https://mirrors.ustc.edu.cn/debian/ bookworm main non-free non-free-firmware contrib deb https://mirrors.ustc.edu.cn/debian-security/ bookworm-security main deb-src https://mirrors.ustc.edu.cn/debian-security/ bookworm-security main deb https://mirrors.ustc.edu.cn/debian/ bookworm-updates main non-free non-free-firmware contrib deb-src https://mirrors.ustc.edu.cn/debian/ bookworm-updates main non-free non-free-firmware contrib deb https://mirrors.ustc.edu.cn/debian/ bookworm-backports main non-free non-free-firmware contrib deb-src https://mirrors.ustc.edu.cn/debian/ bookworm-backports main non-free non-free-firmware contrib EOF
网易源
cat /etc/apt/sources.list << EOF deb https://mirrors.163.com/debian/ bookworm main non-free non-free-firmware contrib deb-src https://mirrors.163.com/debian/ bookworm main non-free non-free-firmware contrib deb https://mirrors.163.com/debian-security/ bookworm-security main deb-src https://mirrors.163.com/debian-security/ bookworm-security main deb https://mirrors.163.com/debian/ bookworm-updates main non-free non-free-firmware contrib deb-src https://mirrors.163.com/debian/ bookworm-updates main non-free non-free-firmware contrib deb https://mirrors.163.com/debian/ bookworm-backports main non-free non-free-firmware contrib deb-src https://mirrors.163.com/debian/ bookworm-backports main non-free non-free-firmware contrib EOF
腾讯云源
cat /etc/apt/sources.list << EOF deb https://mirrors.cloud.tencent.com/debian/ bookworm main non-free non-free-firmware contrib deb-src https://mirrors.cloud.tencent.com/debian/ bookworm main non-free non-free-firmware contrib deb https://mirrors.cloud.tencent.com/debian-security/ bookworm-security main deb-src https://mirrors.cloud.tencent.com/debian-security/ bookworm-security main deb https://mirrors.cloud.tencent.com/debian/ bookworm-updates main non-free non-free-firmware contrib deb-src https://mirrors.cloud.tencent.com/debian/ bookworm-updates main non-free non-free-firmware contrib deb https://mirrors.cloud.tencent.com/debian/ bookworm-backports main non-free non-free-firmware contrib deb-src https://mirrors.cloud.tencent.com/debian/ bookworm-backports main non-free non-free-firmware contrib EOF
更新源 apt-get update
apt-get update
文章评论