From 650b926a0b529c06163f66e96b707db20cd7b19d Mon Sep 17 00:00:00 2001 From: WanWanYun Date: Mon, 10 Nov 2025 23:13:13 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D:=20Debian=E7=B3=BB=E7=BB=9F?= =?UTF-8?q?=E9=98=BF=E9=87=8C=E4=BA=91=E9=95=9C=E5=83=8F=E6=BA=90=E9=85=8D?= =?UTF-8?q?=E7=BD=AE=E9=94=99=E8=AF=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 分离Ubuntu和Debian的源配置逻辑 - Debian使用正确的组件: main, contrib, non-free, non-free-firmware - Debian安全源使用debian-security仓库 - Ubuntu继续使用: main, restricted, universe, multiverse - 修复apt更新时的组件缺失警告 --- install.sh | 28 +++++++++++++++++++++------- 1 file changed, 21 insertions(+), 7 deletions(-) diff --git a/install.sh b/install.sh index 18722b0..2870bb8 100644 --- a/install.sh +++ b/install.sh @@ -189,18 +189,33 @@ configure_aliyun_mirror() { print_step "配置阿里云镜像源..." case $OS in - ubuntu|debian) + ubuntu) # 备份原有源 if [[ ! -f /etc/apt/sources.list.bak ]]; then cp /etc/apt/sources.list /etc/apt/sources.list.bak fi - # 配置阿里云源 + # 配置Ubuntu阿里云源 cat > /etc/apt/sources.list << EOF -deb http://mirrors.aliyun.com/$OS/ $(lsb_release -cs) main restricted universe multiverse -deb http://mirrors.aliyun.com/$OS/ $(lsb_release -cs)-updates main restricted universe multiverse -deb http://mirrors.aliyun.com/$OS/ $(lsb_release -cs)-backports main restricted universe multiverse -deb http://mirrors.aliyun.com/$OS/ $(lsb_release -cs)-security main restricted universe multiverse +deb http://mirrors.aliyun.com/ubuntu/ $(lsb_release -cs) main restricted universe multiverse +deb http://mirrors.aliyun.com/ubuntu/ $(lsb_release -cs)-updates main restricted universe multiverse +deb http://mirrors.aliyun.com/ubuntu/ $(lsb_release -cs)-backports main restricted universe multiverse +deb http://mirrors.aliyun.com/ubuntu/ $(lsb_release -cs)-security main restricted universe multiverse +EOF + print_success "阿里云源配置完成" + ;; + debian) + # 备份原有源 + if [[ ! -f /etc/apt/sources.list.bak ]]; then + cp /etc/apt/sources.list /etc/apt/sources.list.bak + fi + + # 配置Debian阿里云源 + cat > /etc/apt/sources.list << EOF +deb http://mirrors.aliyun.com/debian/ $(lsb_release -cs) main contrib non-free non-free-firmware +deb http://mirrors.aliyun.com/debian/ $(lsb_release -cs)-updates main contrib non-free non-free-firmware +deb http://mirrors.aliyun.com/debian/ $(lsb_release -cs)-backports main contrib non-free non-free-firmware +deb http://mirrors.aliyun.com/debian-security $(lsb_release -cs)-security main contrib non-free non-free-firmware EOF print_success "阿里云源配置完成" ;; @@ -216,7 +231,6 @@ EOF ;; esac } - ################################################################################ # 安装依赖环境 ################################################################################