How to Install DNF Automatic on Fedora 39, 38 Linux

This guide demonstrates how to install DNF Automatic on Fedora Linux, a powerful tool for simplifying system updates. DNF Automatic, part of the DNF package manager, automates keeping your Fedora system up-to-date. Using DNF Automatic ensures your system receives the latest security patches and software updates without manual intervention.

Key Features of DNF Automatic:

  • Automated Updates: Configures your Fedora system to download and apply updates automatically.
  • Customizable Schedules: Allows you to set specific times for updates, ensuring minimal disruption.
  • Security Focused: Automatically applies security patches, enhancing your system’s security.
  • Flexible Configuration: Offers various settings to control how updates are handled, including automatic or manual installation options.
  • Email Notifications: Can be configured to send email notifications about available updates and applied changes.

This tool is handy for administrators and users who prefer not to check for updates manually. The subsequent sections will guide you through the installation process, configuration options, and usage tips for DNF Automatic, making your Fedora Linux experience more efficient and secure.

Install DNF Automatic on Fedora Linux via DNF

Step 1: Refresh Fedora Packages Before DNF Automatic Installation

To maintain compatibility and avoid issues during DNF Automatic installation, update your Fedora system. This step ensures that all existing packages are up to date. In your terminal, execute the following command:

sudo dnf upgrade --refresh

This command refreshes your system’s package database and upgrades all installed packages to their latest versions. It’s a crucial step to avoid conflicts with the new software you’re about to install.

Step 2: Install DNF Automatic via DNF Command

After updating your system, proceed to install DNF Automatic. This tool automates the process of managing package updates on Fedora.

In your open terminal, run the following command:

sudo dnf install dnf-automatic

This command installs DNF Automatic using Fedora’s default package manager, DNF (Dandified YUM). It’s a straightforward and efficient way to ensure your system’s software is constantly updated without manual intervention.

Configure DNF Automatic on Fedora Linux

Editing the Configuration File

To customize DNF Automatic, modify its primary configuration file found at /etc/dnf/automatic.conf. This file houses various settings that dictate how the tool behaves. To access and edit this file, use the nano text editor with the following command:

sudo nano /etc/dnf/automatic.conf

This command opens the configuration file in Nano, a user-friendly, command-line text editor, allowing you to view and edit the settings.

[commands] Section

Setting Operational Modes

The [commands] section is where you specify how DNF Automatic manages and applies updates:

Enabling Automatic Updates

To automate the downloading and installation of updates, set both apply_updates and download_updates to True. This ensures that your system automatically downloads and applies updates without requiring manual intervention:

[commands]
apply_updates = True
download_updates = True
Introducing Random Delay

The random_sleep option introduces a delay in seconds before starting the update process. This can be useful for staggering updates in environments with multiple Fedora systems, reducing the simultaneous load on your network:

[commands]
random_sleep = 3600

Here, 3600 represents a one-hour delay.

Focusing on Security Updates

By setting upgrade_type to security, DNF Automatic will prioritize security-related updates, ensuring critical vulnerabilities are addressed promptly:

[commands]
upgrade_type = security

This setting is particularly important for maintaining the security integrity of your system.

Conditional Reboot

The reboot option controls the system’s reboot behavior post-update. Setting it to when-needed ensures that your system reboots only if the updates require it, minimizing downtime:

[commands]
reboot = when-needed

[emitters] Section

Choosing Reporting Methods

The [emitters] section determines how DNF Automatic reports its activities:

Email Reporting

Configure DNF Automatic to send email reports by setting emit_via to email. Specify the recipient’s email address in email_to. This is useful for system administrators who want to keep track of update statuses remotely:

[emitters]
emit_via = email
email_to = user@example.com
Reporting to Standard Output

For direct reporting to the terminal, use stdio. This option is suitable for those who prefer to monitor updates manually or through scripts:

[emitters]
emit_via = stdio

[command] Section

Customizing Command Emitter

Customize post-update actions in the [command] section:

Setting Custom Command

Use command_format to define a specific command that runs after updates. This feature is helpful in running cleanup scripts or other post-update tasks:

[command]
command_format = /path/to/custom/command {body}
Customizing Command Input

stdin_format allows you to specify the format of the input for the custom command. It can be configured to pass the update output directly to your script or command:

[command]
stdin_format = {body}

[email] Section

Customizing Email Emitter

Tailor how DNF Automatic sends emails:

Setting Sender Email

Change the “From” email address in outgoing update notifications with email_from:

[email]
email_from = user@example.com

This setting is crucial for ensuring email alerts are recognized and not marked as spam.

Specifying SMTP Server

Define the SMTP server for sending emails with email_host. This is particularly useful for integrating with your existing email infrastructure:

[email]
email_host = smtp.example.com

With these examples, you can customize the configuration file to suit your needs and enable DNF Automatic to update your system automatically and regularly.

Enable DNF Automatic Timer on Fedora Linux

Activating DNF Automatic

To activate DNF Automatic, you need to enable and start the service. Achieve this with the following command:

sudo systemctl enable --now dnf-automatic.timer

Executing this command, you’re performing two actions simultaneously. The enable part of the command ensures that the DNF Automatic timer starts automatically at boot, ensuring your system consistently checks for updates. The --now flag immediately starts the timer, without needing to reboot.

Monitoring the Timer Status

After enabling DNF Automatic, confirming it’s scheduled correctly is important. To view the status and schedule of the DNF Automatic timer, use:

systemctl list-timers --all | grep -i 'dnf-automatic'

This command filters the list of all system timers to show only those related to DNF Automatic. It helps you verify that the timer is active and scheduled correctly.

Interpreting the Output

The output of this command provides valuable information about the timer’s schedule. For example:

[joshua@fedora-linux ~]$ systemctl list-timers --all | grep -i 'dnf-automatic'
Fri 2023-03-17 06:08:59 AWST 19h left      -                            -                    dnf-automatic.timer          dnf-automatic.service

In this output:

  • The date and time (Fri 2023-03-17 06:08:59 AWST) indicate when the next update check is scheduled.
  • The 19h left part shows the time remaining until the next check.

This information is crucial for system administrators or users who need to know when their system will next check for and potentially apply updates. It allows for planning around potential system reboots or bandwidth usage.

Conclusion

In this guide, we’ve shown you how to harness the power of DNF Automatic to simplify updates on Fedora. From installing and configuring to activating and monitoring, we’ve covered essential steps to make your Fedora system more secure and up-to-date with minimal effort. DNF Automatic is an excellent tool for anyone looking to reduce the hassle of manual updates, ensuring a stable and secure Fedora experience.

Leave a Comment


Your Mastodon Instance
Share to...