How to Automatically Update OS Packages on a RHEL 8 Host

The task of regularly updating your server is essential for maintaining both system security and stability. However, when managing multiple servers, it can become a daunting and time-consuming task. Fortunately, Red Hat Enterprise Linux (RHEL) 8 provides an efficient solution for automatic updates with the dnf-automatic tool.

In this blog post, we will guide you through the process of setting up dnf-automatic on a RHEL 8 host to automate your OS package updates.

Step 1: Install the dnf-automatic package

First, we need to install the dnf-automatic package. This package enables your system to automatically perform operations such as checking for, downloading, and applying updates. You can install it by running the following command:

sudo dnf install dnf-automatic

Step 2: Configure dnf-automatic

Next, we need to modify the dnf-automatic configuration file. This file, located at /etc/dnf/automatic.conf, controls how dnf-automatic behaves.

Open the file using a text editor of your choice. Here, we’ll use vi:

sudo vi /etc/dnf/automatic.conf

Here are a few options that you might want to adjust according to your needs:

  • upgrade_type: This determines the type of upgrades to apply. Options include default (all updates), security (only security updates), or minimal (minimal updates).
  • download_updates: Set this to yes to enable automatic downloading of updates.
  • apply_updates: If you want dnf-automatic to install updates automatically, set this to yes.

For example, to configure dnf-automatic to automatically install all updates, you would use these settings:

upgrade_type = default
download_updates = yes
apply_updates = yes

After editing, save your changes and close the file.

Step 3: Enable and Start the dnf-automatic Timer

Lastly, we need to enable dnf-automatic to start at boot and start the service immediately. You can do this by running the following command:

sudo systemctl enable --now dnf-automatic.timer

With these steps, dnf-automatic is all set to keep your RHEL 8.8 system updated automatically. You can check the status of the dnf-automatic timer at any time by running sudo systemctl list-timers --all.

Conclusion

Setting up dnf-automatic for automatic updates significantly simplifies the task of keeping your RHEL 8.8 host updated. It’s a handy tool that not only saves time but also ensures that you receive vital updates promptly, thus enhancing your system’s security and stability. Stay updated and stay secure!

Leave a comment

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