Product SiteDocumentation Site

6.8. 保持系統在最新狀態

The Debian distribution is dynamic and changes continually. Most of the changes are in the Testing and Unstable versions, but even Stable is updated from time to time, mostly for security-related fixes. Whatever version of Debian a system runs, it is generally a good idea to keep it up to date, so that you can get the benefit of recent evolution and bug fixes.
最好定期執行升級與更新,雖然很瑣碎卻是必要的。幸運的是,這種重複性的工作可以自動執行,有很多工具可以使用。
第一個工具是 apticron,位於同名套件中。主要作用是每日執行一個腳本 (經由 cron)。這個腳本更新可用套件清單,若已安裝的套件不在此清單內,則發送電子郵件列出該等套件清單,並指出在新版中可用的套件。明顯地,此套件的對象是 Debian 穩定版 的使用者,對其他版本的使用者而言,此清單太長了。取得可更新清單後,apticron 自動下載它們。不會安裝它們 — 那是管理者的權限與工作 — 但已下載的套件可以在地 (於 APT 快取內) 安裝,速度快多了。
Administrators in charge of several computers will no doubt appreciate being informed of pending upgrades, but the upgrades themselves are still as tedious as they used to be. Periodic upgrades can be enabled: it uses a systemd timer unit or cron. If systemd is not installed, the /etc/cron.daily/apt-compat script (in the apt package) comes in handy. This script is run daily (and non-interactively) by cron. To control the behavior, use APT configuration variables (which are therefore stored in a file /etc/apt/apt.conf.d/10periodic). The main variables are:
APT::Periodic::Update-Package-Lists
此選項允許您指定重新載入的頻率。apticron 也可以在無變數的前提下執行,因為 apticron 本來就已在執行中。
APT::Periodic::Download-Upgradeable-Packages
再次地,此選項指定頻率 (以日計),此時實際地下載套件。同樣地,使用者不需指定執行 apticron
APT::Periodic::AutocleanInterval
此選項包括 apticron 沒有的功能。指定過時套件 (未被任何發行版參照) 移出 APT 快取的時機。如此一來,APT 快取的容量就保持在合理的範圍,不必再擔心其工作負擔。
APT::Periodic::Unattended-Upgrade
When this option is enabled, the daily script will execute unattended-upgrade (from the unattended-upgrades package) which — as its name suggest — can automatize the upgrade process for some packages (by default it only takes care of security updates, but this can be customized in /etc/apt/apt.conf.d/50unattended-upgrades). Note that this option can be set with the help of debconf by running dpkg-reconfigure -plow unattended-upgrades. If apt-listbugs is installed, it will prevent an automatic upgrade of packages which are affected by an already reported serious or grave bug.
Other options can allow you to control the cache cleaning behavior with more precision. They are not listed here, but they are described in the /usr/lib/apt/apt.systemd.daily script.
These tools work very well for servers, but desktop users generally prefer a more interactive system. The package gnome-software provides an icon in the notification area of desktop environments when updates are available; clicking on this icon then runs an interface to perform updates. You can browse through available updates, read the short description of the relevant packages and the corresponding changelog entries, and select whether to apply the update or not on a case-by-case basis.
使用 gpk-update-viewer 升級

圖形 6.3. 使用 gpk-update-viewer 升級

This tool is no longer installed in the default GNOME desktop. The new philosophy is that security updates should be automatically installed, either in the background or, preferably, when you shutdown your computer so as to not confuse any running application.