Automatic updates on Fedora

Automatic updates are highly recommended. Configuring your systems to update their packages automatically improves stability, perfomance, and most importantly security of those systems.  The unfortunate nature of software development is that exploits can be discovered or bugs found after release.  Updates allow developers to correct these bugs and close exploits, which is why they are highly recommended.  Setting up automatic updates means the system will update periodically and not need you to check for and install updates manually, ensuring you are kept up to date during an OS’s life-cycle.

Automatic Updates on Fedora via dnf-automatic

On Fedora, you can utilize either the dnf-automatic or yum package managers to facilitate automatic updates.  If you wish to use yum, please see the article on automatic updates for CentOS as the instructions are identical.  However, as the creators of Fedora suggest utilizing dnf-automatic, continue reading to learn how to configure this package for automatic updates.

The first step is to install the package itself.  Do so by running the command below:

dnf install dnf-automatic

Once the package is installed, it needs to be configured.  This is done via a configuration file located at /etc/dnf/automatic.conf . You will need to open this file as root or a user with root access with your preferred text editor.  Once you have the file opened, the areas of immediate concern will be the ‘commands’ and ’emitters’ sections of the file.

In the commands section, you set up what dnf-automatic will do.  You will want to enable “apply_updates” by switching the boolian flag from False to True.  This will tell dnf-automatic to apply any packages it finds when it runs.  You should also check the setting of the “upgrade-type” field.  This should be set to ‘default’ which updates all packages that dnf-automatic finds an update for.  You can also set this to ‘security’ which will only apply updates it finds with an attached security advisory.

In the emitters section, you can designate how dnf-automatic informs you of its results when it runs.  The emit_via field determines the method or methods of delivery, and can be set to ‘stdio’, ’email’, or ‘motd’ which will display results directly to your terminal, via an email to an address of your choice, or via the server’s message of the day respectively.  You can also set it to report via a custom command via the ‘command’ choice.  Finally you can send an email via a command as well with the ‘command_email’ option.  Multiple options can be selected to deliver the results to multiple places at once.  Regardless of choice, make sure to update and check the settings for any options you have enabled.

Once you are done editing the configuration file, dnf-automatic needs to be enabled with systemctl in order to run automatically.  You can do this with the command that follows:

systemctl enable --now dnf-automatic.timer

You should now have updates being performed periodically and automatically to your system.  If you wish to change the frequency or scheduling of these updates, they can be manipulated like any other systemctl timer. 

Leave a Reply

Your email address will not be published. Required fields are marked *