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.
利用できる更新を確認してアップグレードを実行するために日常的にツールを実行することはもちろん可能ですが、特に複数のマシンでこれを行う必要がある場合、このような反復作業は面白くありません。幸いなことに、多くの反復作業と同様この作業もある程度自動化が可能で、効果的な一連のツールが開発されています。
更新作業の自動化を担うツールの 1 つ目は apticron で、同名のパッケージに含まれます。apticron の主たる挙動は (cron を使って) 毎日スクリプトを実行することです。スクリプトは利用できるパッケージのリストを更新し、インストール済みパッケージが入手できる最新バージョンと異なる場合、そのようなパッケージのリストと新しいバージョンにおける修正点をメールで送信します。apticron の挙動は明らかに Debian 安定版のユーザを対象にしています。なぜなら、より頻繁にパッケージが更新される Debian の他のディストリビューションでは毎日のメールがとても長くなるからです。更新が利用できるようになったら、apticron は自動的にそれらをダウンロードします。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.
上記以外のオプションを使うことで、さらに精密なキャッシュ消去挙動を制御できます。それらのオプションをここに載せることはしませんが、詳しい説明は /usr/lib/apt/apt.systemd.daily スクリプトを参照してください。
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 を使ったアップグレード

現在では gpk-update-viewer はデフォルトの GNOME デスクトップにインストールされません。新しい原則に従うなら、セキュリティ更新は自動インストールされるべきであり、これはバックグラウンドで行われるか、起動中のアプリケーションに対する無用の混乱を避けるためにコンピュータをシャットダウンする際に行われるべきです。