Debian Minimal 更新与升级指南
一 日常更新与升级
sudo apt update
sudo apt upgrade -y
sudo apt full-upgrade -y
sudo apt autoremove -y
sudo apt clean
二 跨版本升级步骤
cat /etc/debian_version 或 lsb_release -a。sudo sed -i 's/bullseye/bookworm/g' /etc/apt/sources.list
sudo sed -i 's/bullseye/bookworm/g' /etc/apt/sources.list.d/*.list
sudo apt update
sudo apt full-upgrade -y
sudo apt autoremove -y
sudo reboot
cat /etc/debian_version
lsb_release -a
三 内核与引导管理
uname -a
sudo apt update
sudo apt install linux-image-amd64 linux-headers-amd64 linux-base -y
sudo reboot
mkdir -p /kernel && cd /kernel
wget -c https://kernel.ubuntu.com/kernel-ppa/mainline/v6.3.7/amd64/linux-headers-6.3.7-060307-generic_6.3.7-060307.202306090936_amd64.deb
wget -c https://kernel.ubuntu.com/kernel-ppa/mainline/v6.3.7/amd64/linux-headers-6.3.7-060307_6.3.7-060307.202306090936_all.deb
wget -c https://kernel.ubuntu.com/kernel-ppa/mainline/v6.3.7/amd64/linux-image-unsigned-6.3.7-060307-generic_6.3.7-060307.202306090936_amd64.deb
wget -c https://kernel.ubuntu.com/kernel-ppa/mainline/v6.3.7/amd64/linux-modules-6.3.7-060307-generic_6.3.7-060307.202306090936_amd64.deb
sudo dpkg -i *.deb
sudo update-grub
sudo reboot
四 自动更新与安全加固
sudo apt install unattended-upgrades -y
sudo dpkg-reconfigure unattended-upgrades
sudo systemctl status apt-daily.timer
sudo systemctl status apt-daily-upgrade.timer
sudo systemctl enable --now apt-daily.timer
sudo systemctl enable --now apt-daily-upgrade.timer
sudo unattended-upgrade --dry-run
五 常见问题与实用技巧
sudo apt install --only-upgrade 包名
sudo apt-mark hold 包名
sudo apt-mark unhold 包名
sudo apt autoremove -y
sudo apt clean
sudo apt install --no-install-recommends ca-certificates curl wget vim htop tmux screen