答案1
(之前的发帖者已经发出了有关自动升级的警告。)
考虑到 Debian 安全团队在过去几年的业绩记录,我认为升级失败的风险远低于在很少访问的系统上进行自动更新的好处。
Debian Lenny 自带无人值守升级,它源自 Ubuntu,被认为是从 Lenny/5.0 开始的 Debian 无人值守升级的事实上的解决方案。
要在 Debian 系统上启动并运行它,您需要安装该unattended-upgrades
软件包。
然后将这些行添加到/etc/apt/apt.conf
:
APT::Periodic::更新包列表“1”; APT::定期::无人值守升级“1”;
(注意:在 Debian Squeeze/6.0 中没有/etc/apt/apt.conf
。首选方法是使用以下命令,它将在 中创建上述行/etc/apt/apt.conf.d/20auto-upgrades
:)
sudo dpkg-reconfigure -plow 无人值守升级
然后每晚运行一个 cron 作业并检查是否有需要安装的安全更新。
可以在 中监控无人值守升级的操作/var/log/unattended-upgrades/
。请注意,要使内核安全修复生效,您需要手动重启服务器。这也可以在计划的(例如每月)维护时段内自动完成。
答案2
Apt 现在带有自己的 cron 作业 /etc/cron.daily/apt,并且文档可以在文件本身中找到:
#set -e
#
# This file understands the following apt configuration variables:
#
# "APT::Periodic::Update-Package-Lists=1"
# - Do "apt-get update" automatically every n-days (0=disable)
#
# "APT::Periodic::Download-Upgradeable-Packages=0",
# - Do "apt-get upgrade --download-only" every n-days (0=disable)
#
# "APT::Periodic::AutocleanInterval"
# - Do "apt-get autoclean" every n-days (0=disable)
#
# "APT::Periodic::Unattended-Upgrade"
# - Run the "unattended-upgrade" security upgrade script
# every n-days (0=disabled)
# Requires the package "unattended-upgrades" and will write
# a log in /var/log/unattended-upgrades
#
# "APT::Archives::MaxAge",
# - Set maximum allowed age of a cache package file. If a cache
# package file is older it is deleted (0=disable)
#
# "APT::Archives::MaxSize",
# - Set maximum size of the cache in MB (0=disable). If the cache
# is bigger, cached package files are deleted until the size
# requirement is met (the biggest packages will be deleted
# first).
#
# "APT::Archives::MinAge"
# - Set minimum age of a package file. If a file is younger it
# will not be deleted (0=disable). Usefull to prevent races
# and to keep backups of the packages for emergency.
答案3
只需安装 apticron 并更改 /etc/apticron/apticron.conf 中的 EMAIL= 设置
Apticron 将检查最新更新并下载。它不会安装它们。它会向您发送一封包含待处理的更新的邮件。
答案4
我从不使用自动更新。我喜欢在我身边的时候进行升级,这样如果出现问题,我有时间清理。如果你不想处理安全公告,请决定在检查更新之间间隔多长时间,然后决定每周进行更新。很简单:“aptitude update; aptitude dist-upgrade(或 aptitude safe-upgrade)”
我宁愿花一点时间来做这件事,也不愿让我的邮件服务器突然消失并且不能自动重新启动。