Debian CD安装后修改源

shell

实例为debian12的源,如果是其他版本,查找替换即可

#!/bin/bash

# 步骤1:清空 /etc/apt/sources.list 文件
echo "" > /etc/apt/sources.list

# 步骤2:将阿里云源添加到 sources.list 文件
echo "deb https://mirrors.aliyun.com/debian/ bookworm main contrib non-free" >> /etc/apt/sources.list
echo "deb https://mirrors.aliyun.com/debian/ bookworm-updates main contrib non-free" >> /etc/apt/sources.list
echo "deb https://mirrors.aliyun.com/debian-security/ bookworm-security main contrib non-free" >> /etc/apt/sources.list

# 步骤3:更新软件包列表
apt update