Ubuntu 24.04 彻底关闭自动更新(桌面+服务器通用)

发布时间:2026/7/9 5:47:03
Ubuntu 24.04 彻底关闭自动更新(桌面+服务器通用) Ubuntu 24.04 彻底关闭自动更新桌面服务器通用分三种方案图形界面快速关闭桌面、命令行标准关闭推荐、彻底锁死所有自动更新生产服务器一、图形界面关闭Desktop 桌面版打开「软件和更新」gnome-control-center software切换到Updates标签页修改下拉选项Automatically check for updatesNeverWhen there are security updatesDisplay immediately不自动下载安装When there are other updatesDisplay weeklyNotify me of a new Ubuntu versionNever关闭窗口设置立即生效二、命令行标准关闭通用桌面/服务器1. 交互式关闭无人值守自动升级sudodpkg-reconfigure-plowunattended-upgrades弹出选项选No回车自动修改配置文件。2. 手动修改自动更新配置sudonano/etc/apt/apt.conf.d/20auto-upgrades全部改为 00关闭1开启APT::Periodic::Update-Package-Lists 0; APT::Periodic::Unattended-Upgrade 0;保存CtrlO→ 回车 →CtrlX3. 停止并禁用自动更新服务# 停止无人值守升级sudosystemctl stop--nowunattended-upgradessudosystemctl disable unattended-upgrades# 关闭每日apt检查定时任务核心后台自动检查sudosystemctl stop--nowapt-daily.timer apt-daily-upgrade.timersudosystemctl disable apt-daily.timer apt-daily-upgrade.timer三、彻底锁死生产服务器完全杜绝后台更新在上面基础上屏蔽服务禁用固件自动更新关闭更新弹窗# 屏蔽apt定时与自动升级服务无法自启sudosystemctl mask unattended-upgrades apt-daily.service apt-daily-upgrade.service apt-daily.timer apt-daily-upgrade.timer# 关闭固件自动更新fwupdsudosystemctl mask fwupd fwupd-refresh.timer fwupd-offline-update# 关闭桌面右上角更新提示桌面版执行sudomv/etc/xdg/autostart/update-notifier.desktop /etc/xdg/autostart/update-notifier.desktop.bak四、关闭 Snap 自动更新弹窗频繁更新snapUbuntu24.04 默认Firefox为snap会后台自动更新# 禁止snap自动刷新sudosnapsetsystemrefresh.timer00:00,00:00# 查看snap刷新状态snap get system refresh五、恢复自动更新需要时# 解除屏蔽sudosystemctl unmask unattended-upgrades apt-daily.service apt-daily-upgrade.service apt-daily.timer apt-daily-upgrade.timer fwupd fwupd-refresh.timer fwupd-offline-update# 启用定时任务sudosystemctlenable--nowapt-daily.timer apt-daily-upgrade.timer unattended-upgrades# 恢复配置sudodpkg-reconfigure-plowunattended-upgrades# 选Yes# 恢复snap更新sudosnapsetsystemrefresh.timer00:00~24:00重要提醒关闭自动更新后不会自动安装安全补丁建议定期手动执行更新sudoaptupdatesudoaptupgrade-y