Linux Minimal系统更新方法
一、通用准备
cat /etc/os-release,记录如Ubuntu 22.04、CentOS Stream 9、RHEL 9、Debian 12等,以便选择对应命令与仓库。/etc/network/interfaces或nmcli/nmtui,并测试ping通仓库域名。二、按发行版执行更新
sudo apt update && sudo apt upgrade -ysudo apt install linux-generic-hwe-22.04 -ysudo apt install update-manager-core -y && sudo do-release-upgradesudo rebootsudo apt update && sudo apt full-upgrade -ysudo apt autoremove -y && sudo apt autocleansudo rebootsudo yum update -ysudo rebootsudo dnf update -ysudo rebootsudo microdnf update -y && sudo microdnf clean all三、升级到新版本
do-release-upgrade:sudo apt install update-manager-core -ysudo do-release-upgrade,按提示完成;升级后重启。apt full-upgrade完成;跨主版本建议备份后使用安装介质或do-release-upgrade(若已安装对应工具)。yum/dnf update完成;跨主版本通常需全新安装或使用官方升级工具(如leapp);生产环境建议在测试环境验证后再执行。四、最小化系统的注意事项
microdnf管理软件包。sudo apt install -y vim或microdnf install -y vim。microdnf module enable/disable/reset <模块名>,便于获取多版本软件(如 Node.js 模块流)。uname -rcat /etc/os-releaseapt list --upgradable、dnf check-update、yum check-update