debian 9 更换源 使用国内源 配置方法

时间:2024-04-16 12:19:31

配置前请先参考:

https://wiki.debian.org/SourcesList
https://www.debian.org/mirror/list
https://mirrors.tuna.tsinghua.edu.cn/help/debian/
http://mirrors.ustc.edu.cn/help/debian.html

官方镜像地址:

ftp.cn.debian.org   #中科大
ftp2.cn.debian.org  #清华
nano /etc/apt/sources.list

deb http://ftp.cn.debian.org/debian stretch main
deb http://ftp.cn.debian.org/debian-security stretch/updates main
deb http://ftp.cn.debian.org/debian stretch-updates main

使用https地址,可以有效避免国内运营商的缓存劫持
以清华大学地址为例:

apt install apt-transport-https
nano /etc/apt/sources.list

deb https://mirrors.tuna.tsinghua.edu.cn/debian stretch main contrib non-free
deb https://mirrors.tuna.tsinghua.edu.cn/debian stretch-updates main contrib non-free
deb https://mirrors.tuna.tsinghua.edu.cn/debian-security stretch/updates main contrib non-free
#backports请按需使用
#deb https://mirrors.tuna.tsinghua.edu.cn/debian stretch-backports main contrib non-free 
#buster请按需使用
#deb https://mirrors.tuna.tsinghua.edu.cn/debian buster main

backports、buster说明:

使用backports安装应用:

apt -t stretch-backports install ...

https://backports.debian.org
https://wiki.debian.org/Backports

buster是debian 10的版本代号,配置buster源可以安装某些应用的最新版本,例如nano
https://wiki.debian.org/DebianBuster
https://serverfault.com/questions/22414/how-can-i-run-debian-stable-but-install-some-packages-from-testing