Linux换源

1 Linux换源

换源前先查看当前系统版本:

1
cat /etc/os-release

输出:

1
2
3
4
5
6
7
8
9
10
(venv) root@server:/# cat /etc/os-release
PRETTY_NAME="Debian GNU/Linux 12 (bookworm)"
NAME="Debian GNU/Linux"
VERSION_ID="12"
VERSION="12 (bookworm)"
VERSION_CODENAME=bookworm
ID=debian
HOME_URL="https://www.debian.org/"
SUPPORT_URL="https://www.debian.org/support"
BUG_REPORT_URL="https://bugs.debian.org/

查看系统版本后,可以选择适合自己的源.

1.1 Debian换源

  1. 备份源列表:
    1
    cp /etc/apt/sources.list /etc/apt/sources.list.bak
  2. 编辑源列表:
    1
    vim /etc/apt/sources.list
    注销原有源,添加新的源即可。
    3.2024/11/7可用源:
    1
    2
    3
    4
    5
    6
    7
    8
    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