1
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

Debian/Ubuntuのすべてのパッケージを自動的に最新にする

Last updated at Posted at 2025-05-07

初投稿なので小ネタ。自分のサイトにも載せた話題とだいたい同じ。

DebianやUbuntuのサーバーでインストールされているパッケージをPPAなどのサードパーティのヤツも含めてとにかく全部自動的にアップデートするための設定を行う。

まず/etc/apt/apt.conf.d/20auto-upgradesに以下の記述がなければ追記する。

APT::Periodic::Update-Package-Lists "1";
APT::Periodic::Unattended-Upgrade "1";

次に/etc/apt/apt.conf.d/52unattended-upgrades-localというファイルを作って以下のような内容を記述する。

Unattended-Upgrade::Allowed-Origins {
        "*:*";
}

Unattended-Upgrade::Remove-Unused-Dependencies "true";
Unattended-Upgrade::Automatic-Reboot "true";
Unattended-Upgrade::Automatic-Reboot-Time "04:00";

上記の「* : *」(実際はスペースなし) の指定がとにかくなんでもかんでもアップデートするという指定だ。もちろん設定ファイルがコンフリクトするヤツとかはアップデートされずに引っかかっていることはあるのでたまにサーバーにログインして確認しよう。

その下の3行はそれぞれ「apt autoremoveに相当する処理を実行する」「カーネルとかアップデートされたらリブートする」「リブートするのは午前4時」という指定だ。

本番運用のサーバーでは結構乱暴な設定かもしれないので、真似する方はご注意。

1
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?