AngusWong's 博客

  • 首页
  • Linux
  • Mac
  • PHP
  • 数据库
  • 路由相关
专注于计算机相关技术分享
  1. 首页
  2. Linux
  3. 正文

Debian12更换国内源

2025年3月5日 264点热度 0人点赞 0条评论

新的版本已经移除文件 /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

 

标签: Debian12 中科大源 国内源 网易源 腾讯云源 阿里云源
最后更新:2025年3月5日

Sean

这个人很懒,什么都没留下

点赞
< 上一篇
下一篇 >

文章评论

razz evil exclaim smile redface biggrin eek confused idea lol mad twisted rolleyes wink cool arrow neutral cry mrgreen drooling persevering
取消回复
分类
  • Linux
  • Mac
  • PHP
  • 其他
  • 前端
  • 数据库
  • 路由相关
最新 热点 随机
最新 热点 随机
macOS Sonoma, macOS Sequoia删除Mac启动台里删不掉的图标 PVE8修改软件仓库源和 CT模板(LXC)源为国内源 Debian12更换国内源 构建宝塔面板Docker镜像 无需root!卸载小米电视/盒子内置应用 检查系统是否被入侵
解决Linux系统进程杀掉后又自动启动的问题 Gitlab13.* 最新社区版本使用GitLab Runner自动部署代码 Yapi二次开发后重新打包发布 MySql数据库备份与恢复——使用mysqldump 导入与导出 使用宝塔面板安装的Gitlab更改配置 强大的Sed命令

COPYRIGHT © 2021 huangyuqiang.cn. ALL RIGHTS RESERVED.

Theme Kratos Made By Seaton Jiang