---
mirrorId: debian
---

import ConfigGenerator from '../../src/components/config-generator'

export const debianVersions = [
    "bookworm", // 12
    "bullseye", // 11
    "buster",   // 10
    "stretch",  // 9
    "jessie",   // 8
    "testing",  // next stable in dev
    "sid",      // unstable
]

export const GenDebianConfig = (version) => {
    if (version === 'sid') { // unstable
        return `# 默认注释了源码镜像以提高 apt update 速度，如有需要可自行取消注释
deb https://mirrors.zju.edu.cn/debian/ sid main contrib non-free non-free-firmware
# deb-src https://mirrors.zju.edu.cn/debian/ sid main contrib non-free non-free-firmware`
    } else if (version === 'bullseye') { // 11
    return `# 默认注释了源码镜像以提高 apt update 速度，如有需要可自行取消注释
deb https://mirrors.zju.edu.cn/debian/ ${version} main contrib non-free
# deb-src https://mirrors.zju.edu.cn/debian/ ${version} main contrib non-free
deb https://mirrors.zju.edu.cn/debian/ ${version}-updates main contrib non-free
# deb-src https://mirrors.zju.edu.cn/debian/ ${version}-updates main contrib non-free\n
deb https://mirrors.zju.edu.cn/debian/ ${version}-backports main contrib non-free
# deb-src https://mirrors.zju.edu.cn/debian/ ${version}-backports main contrib non-free\n
deb https://mirrors.zju.edu.cn/debian-security ${version}-security main contrib non-free
# deb-src https://mirrors.zju.edu.cn/debian-security ${version}-security main contrib non-free`
    } else if (version === 'buster' || version === 'stretch') { // 9, 10
        return `# 默认注释了源码镜像以提高 apt update 速度，如有需要可自行取消注释
deb https://mirrors.zju.edu.cn/debian/ ${version} main contrib non-free
# deb-src https://mirrors.zju.edu.cn/debian/ ${version} main contrib non-free
deb https://mirrors.zju.edu.cn/debian/ ${version}-updates main contrib non-free
# deb-src https://mirrors.zju.edu.cn/debian/ ${version}-updates main contrib non-free
deb https://mirrors.zju.edu.cn/debian/ ${version}-backports main contrib non-free
# deb-src https://mirrors.zju.edu.cn/debian/ ${version}-backports main contrib non-free
deb https://mirrors.zju.edu.cn/debian-security ${version}/updates main contrib non-free
# deb-src https://mirrors.zju.edu.cn/debian-security ${version}/updates main contrib non-free`
    } else if (version === 'jessie') { // 8
        return `# 默认注释了源码镜像以提高 apt update 速度，如有需要可自行取消注释
deb https://mirrors.zju.edu.cn/debian/ jessie main contrib non-free
# deb-src https://mirrors.zju.edu.cn/debian/ jessie main contrib non-free
deb https://mirrors.zju.edu.cn/debian/ jessie-updates main contrib non-free
# deb-src https://mirrors.zju.edu.cn/debian/ jessie-updates main contrib non-free
deb https://mirrors.zju.edu.cn/debian-security jessie/updates main contrib non-free
# deb-src https://mirrors.zju.edu.cn/debian-security jessie/updates main contrib non-free`
    }
    return `# 默认注释了源码镜像以提高 apt update 速度，如有需要可自行取消注释
deb https://mirrors.zju.edu.cn/debian/ ${version} main contrib non-free non-free-firmware
# deb-src https://mirrors.zju.edu.cn/debian/ ${version} main contrib non-free non-free-firmware
deb https://mirrors.zju.edu.cn/debian/ ${version}-updates main contrib non-free non-free-firmware
# deb-src https://mirrors.zju.edu.cn/debian/ ${version}-updates main contrib non-free non-free-firmware
deb https://mirrors.zju.edu.cn/debian/ ${version}-backports main contrib non-free non-free-firmware
# deb-src https://mirrors.zju.edu.cn/debian/ ${version}-backports main contrib non-free non-free-firmware
deb https://mirrors.zju.edu.cn/debian-security ${version}-security main contrib non-free non-free-firmware
# deb-src https://mirrors.zju.edu.cn/debian-security ${version}-security main contrib non-free non-free-firmware`
}

Debian 的软件源配置文件是 `/etc/apt/sources.list`。将系统自带的该文件做个备份，将该文件替换为下面内容，即可使用我们的软件源镜像。

如果遇到无法拉取 https 源的情况，请先使用 http 源并安装: 

```bash
sudo apt install apt-transport-https ca-certificates
```

再使用我们的软件源镜像。

<ConfigGenerator promptString="请选择您的 Debian 版本：" versionList={debianVersions} configGen={GenDebianConfig} language="bash" />
