Skip to content

Instantly share code, notes, and snippets.

@AskinNet
Forked from Aldaviva/linux-autoupdate.md
Created March 7, 2025 13:32
Show Gist options
  • Save AskinNet/a10d97b2cc8a1ed78796826abe34d066 to your computer and use it in GitHub Desktop.
Save AskinNet/a10d97b2cc8a1ed78796826abe34d066 to your computer and use it in GitHub Desktop.
Enable automatic updates in Fedora and Debian
  1. Install plugin

    sudo apt install unattended-upgrades
  2. Edit package behavior

    Create a new configuration override file and set its contents to the following, changing values to your liking.

    sudo $EDITOR /etc/apt/apt.conf.d/51unattended-upgrades-local
    Unattended-Upgrade::Origins-Pattern {
        "origin=*";
    };
    
    Unattended-Upgrade::Automatic-Reboot "false";
    

    This will upgrade all packages, regardless of which repository they come from. It won't reboot after installing upgrades.

See Debian Reference § 2.7.3: Automatic download and upgrade of packages, /etc/apt/apt.conf.d/50unattended-upgrades and /usr/share/doc/unattended-upgrades/README.md.gz for documentation, defaults, and examples.

  1. Install plugin
    sudo dnf install dnf5-plugin-automatic
  2. Edit plugin behavior
    sudo cp /usr/share/dnf5/dnf5-plugins/automatic.conf /etc/dnf/automatic.conf
    sudo $EDITOR /etc/dnf/automatic.conf
    commands.apply_updates can be set to yes to actually install the updates instead of only downloading them
  3. Edit timer
    sudo systemctl edit dnf5-automatic.timer
    For example, to make DNF install updates at exactly 1:05 AM every day, you can set the file contents to
    [Timer]
    OnCalendar=*-*-* 1:05
    RandomizedDelaySec=0
    more systemd timer examples
  4. Enable timer
    sudo systemctl enable --now dnf5-automatic.timer
  5. Verify timer status
    systemctl status dnf5-automatic.timer
    systemctl list-timers --all dnf5-automatic
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment