Autoupdate DNF Packages

Automatically upgrade DNF packages in the background. I’ve been using this configuration for a long long time, no system breaks yet.

  1. Install dnf-automatic (Fedora)
1
sudo dnf install dnf-automatic
  1. Edit /etc/dnf/automatic.conf
1
sudo vim /etc/dnf/automatic.conf

You can tweak which kind of automatic upgrade you want (default, security) and if you want to automatically reboot the system. I recommend default, applying updates and not rebooting the system for a more friendly experience. At the end you will reboot anyway.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
[commands]
#  What kind of upgrade to perform:
# default                            = all available upgrades
# security                           = only the security upgrades
upgrade_type = default
random_sleep = 0

# Maximum time in seconds to wait until the system is on-line and able to
# connect to remote repositories.
network_online_timeout = 60

# To just receive updates use dnf-automatic-notifyonly.timer

# Whether updates should be downloaded when they are available, by
# dnf-automatic.timer. notifyonly.timer, download.timer and
# install.timer override this setting.
download_updates = yes

# Whether updates should be applied when they are available, by
# dnf-automatic.timer. notifyonly.timer, download.timer and
# install.timer override this setting.
apply_updates = yes

# When the system should reboot following upgrades:
# never                              = don't reboot after upgrades
# when-changed                       = reboot after any changes
# when-needed                        = reboot when necessary to apply changes
  1. Enable the dnf automatic timer (and verify it’s running)
1
2
systemctl enable --now dnf-automatic.timer
systemctl list-timers 'dnf-*'

Source