Debian12安装后新增阿里apt源 #
Debian12安装时默认情况是不使用网络镜像源的,也不建议在安装时指定网络镜像源
之前有一次在使用安装时指定了网络镜像源,但是后面安装时花费太长时间,最后直接停止安装后重新安装
推荐是在系统安装完成后,手动添加apt源,速度会快很多。
初次安装后
初次安装完成后,系统默认无网络镜像源,此时执行 apt update
会出现如下错误:
apt源文件
source.list
list
#deb cdrom:[Debian GNU/Linux 12.4.0 _Bookworm_ - Official amd64 DVD Binary-1 with firmware 20231210-17:57]/ bookworm main non-free-firmware
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
手动添加apt源文件
将 source.list 文件内容复制到 /etc/apt/sources.list.d/ 目录下
此时再次执行 apt update
即可正常更新apt源
去除异常
如果不想看到上图中的错误提示,可将 /etc/apt/sources.list 文件中的内容注释即可
再次执行 apt update
即可正常更新apt源