刚离线装完debian12,安装软件需要更换软件仓库源。下边的方法
一、debian换国内源
1.备份原有源
在更换Debian软件源之前,建议先备份原有的源列表。可以通过以下命令进行备份:
sudo cp /etc/apt/sources.list /etc/apt/sources.list.bak
2.选择国内源
国内有很多优秀的Debian软件源,例如阿里云、清华大学镜像站、中科大镜像站等。可以根据自己所在地区选择相应的源。
这里有源地址根据需要自己修改
nano /etc/apt/sources.list
把刚才的修改好源地址复制到文件中
# 默认注释了源码镜像以提高 apt update 速度,如有需要可自行取消注释
deb https://mirrors.tuna.tsinghua.edu.cn/debian/ bookworm main contrib non-free non-free-firmware
deb-src https://mirrors.tuna.tsinghua.edu.cn/debian/ bookworm main contrib non-free non-free-firmware
deb https://mirrors.tuna.tsinghua.edu.cn/debian/ bookworm-updates main contrib non-free non-free-firmware
deb-src https://mirrors.tuna.tsinghua.edu.cn/debian/ bookworm-updates main contrib non-free non-free-firmware
deb https://mirrors.tuna.tsinghua.edu.cn/debian/ bookworm-backports main contrib non-free non-free-firmware
deb-src https://mirrors.tuna.tsinghua.edu.cn/debian/ bookworm-backports main contrib non-free non-free-firmware
deb https://mirrors.tuna.tsinghua.edu.cn/debian-security bookworm-security main contrib non-free non-free-firmware
deb-src https://mirrors.tuna.tsinghua.edu.cn/debian-security bookworm-security main contrib non-free non-free-firmware
# deb https://security.debian.org/debian-security bookworm-security main contrib non-free non-free-firmware
# deb-src https://security.debian.org/debian-security bookworm-security main contrib non-free non-free-firmware
3.替换源列表
将原有的源列表替换为新选择的国内源。可以通过以下命令进行替换:
sudo nano /etc/apt/sources.list
将原有的源地址全部删除,然后将新选择的国内源地址复制到该文件中即可。保存并退出。
4.更新软件包列表
更换Debian软件源之后,需要更新软件包列表。可以通过以下命令进行更新:
sudo apt-get update
评论0