debian 常用脚本

1. 一键重装

bash <(curl -fsSL "https://raw.githubusercontent.com/bin456789/reinstall/main/reinstall.sh") debian 12

⚠️ 会清空磁盘所有数据,执行前确认数据已备份。

2. 初始化

echo -e "nameserver 1.1.1.1" > /etc/resolv.conf
> /etc/motd
hostnamectl set-hostname localhost
exec bash

3. 重置软件源

rm -rf /etc/apt/mirrors/
> /etc/apt/sources.list
cat > /etc/apt/sources.list.d/debian.sources <<'EOF'
Types: deb
URIs: http://deb.debian.org/debian
Suites: bookworm bookworm-updates bookworm-backports
Components: main contrib non-free non-free-firmware
Signed-By: /usr/share/keyrings/debian-archive-keyring.gpg

Types: deb-src
URIs: http://deb.debian.org/debian
Suites: bookworm bookworm-updates bookworm-backports
Components: main contrib non-free non-free-firmware
Signed-By: /usr/share/keyrings/debian-archive-keyring.gpg

Types: deb
URIs: http://deb.debian.org/debian-security
Suites: bookworm-security
Components: main contrib non-free non-free-firmware
Signed-By: /usr/share/keyrings/debian-archive-keyring.gpg

Types: deb-src
URIs: http://deb.debian.org/debian-security
Suites: bookworm-security
Components: main contrib non-free non-free-firmware
Signed-By: /usr/share/keyrings/debian-archive-keyring.gpg
EOF

4. 更新与安装

apt -y update
apt -y full-upgrade
apt -y install wget curl jq sudo vim ca-certificates cron unzip git gpg aria2 tmux

5. BBR

bash <(curl -fsSL https://raw.githubusercontent.com/vansour/bbr/main/bbr.sh)