How to Set up Automatic Updates on Fedora Linux

This article shows how to set up the dnf-automatic service to apply updates automatically on a Fedora Linux.

If you’re using Fedora as your operating system, keeping your system up to date with the latest software and security patches is important. One way to ensure your system stays current and secure is by setting up automatic updates. This process is simple and only takes a few easy steps.

Fortunately, Fedora provides a ready-made solution to deal with this case that can be quickly and easily implemented without much effort. Following this guide, you can easily set up automatic updates on your Fedora system and never have to worry about manually updating again. So let me show you how.

Step 1: Install the dnf-automatic Package

To enable automatic updates on your Fedora system, you need to install the dnf-automatic package and then configure it according to your needs. So let’s first install it using the following DNF command:

sudo dnf install dnf-automatic
Installing the dnf-automatic package on Fedora
Installing the dnf-automatic package on Fedora

Step 2: Configure Automatic Updates on Fedora

Now that you have the package installed, you need to make the necessary adjustments to your Fedora system’s automated updates according to your preferences. The configuration file in charge of these settings is /etc/dnf/automatic.conf. So, use your preferred text editor to open it:

sudo vim /etc/dnf/automatic.conf

Take a look at the “upgrade_type” option. Here you have two choices: “default” and “security.” Let me explain the difference between them.

By using the “default,” all packages are updated. However, this can be risky if some of your applications are sensitive to updates. So you could change it to apply only security updates by replacing the “default” value with “security.”

Nevertheless, if you use Fedora mainly as your desktop system, my recommendation is to stick with the “default” option.

Configure the upgrade_type option
Configure the upgrade_type option

Next, ensure the “apply_updates” option is set to “yes.” By default, its value is “no.” Otherwise, the dnf-automatic service will only download but not install available updates.

Configure the apply_updates option
Configure the apply_updates option

So far, so good. In the next step, you will configure the dnf-automatic.timer service according to your needs.

Step 3: Setting up the dnf-automatic Timer

Unlike some systemd services, dnf-automatic is implemented as a timer rather than a service that runs in the background perpetuity. But what are timers? Let me explain. They are systemd unit files that end in “.timer” and control “.service” files or events. In other words, they can be used as an alternative to cron.

Let’s open it for editing using the following command:

sudo systemctl edit dnf-automatic.timerCode language: CSS (css)

Next, add the following to the file.

[Timer]
OnCalendar=*-*-* 6:00
RandomizedDelaySec=60m

Make sure you insert the snippet exactly where as is shown below. Here, the automatic update process on your Fedora system will start between 6:00 am and 7:00 am. The “RandomizedDelaySec=60m” option is used as a random extra time delta to avoid all of your machines updating simultaneously.

Setting up the dnf-automatic timer
Setting up the dnf-automatic timer

Finally, to enable and start the dnf-automatic service, use the following command:

sudo systemctl enable --now dnf-automatic.timerCode language: CSS (css)
Enable automatic updates timer on Fedora
Enable automatic updates timer on Fedora

Use the following command to check the status of the automatic update process:

systemctl list-timers *dnf-*Code language: PHP (php)
Checking automatic updates timer status
Checking automatic updates timer status

That’s! The dnf-automatic service will now automatically install updates on your Fedora system. Additionally, you can find more in-depth information on the individual options here.

Conclusion

Setting up automatic updates on Fedora is a straightforward task that can be easily accomplished by following the steps outlined in this article. The dnf-automatic service keeps your system updated and secured by installing the most recent updates and security patches as soon as they become available.

So, no more having to check for and install updates manually. However, as best practice, you should still manually verify that updates are being applied from time to time.

I hope you found this guide helpful. Any suggestions and comments are welcome in the comments section below.

Bobby Borisov

Bobby Borisov

Bobby, an editor-in-chief at Linuxiac, is a Linux professional with over 20 years of experience. With a strong focus on Linux and open-source software, he has worked as a Senior Linux System Administrator, Software Developer, and DevOps Engineer for small and large multinational companies.

Think You're an Ubuntu Expert? Let's Find Out!

Put your knowledge to the test in our lightning-fast Ubuntu quiz!
Ten questions to challenge yourself to see if you're a Linux legend or just a penguin in the making.

1 / 10

Ubuntu is an ancient African word that means:

2 / 10

Who is the Ubuntu's founder?

3 / 10

What year was the first official Ubuntu release?

4 / 10

What does the Ubuntu logo symbolize?

5 / 10

What package format does Ubuntu use for installing software?

6 / 10

When are Ubuntu's LTS versions released?

7 / 10

What is Unity?

8 / 10

What are Ubuntu versions named after?

9 / 10

What's Ubuntu Core?

10 / 10

Which Ubuntu version is Snap introduced?

The average score is 68%

Leave a Reply

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