Red Hat 8 How to Set Up Automatic Updates for CentOS 8

The best thing you can do for your data and machine is to keep them secure. It can be as easy as turning on updates. However, most people using CentOS 8 don’t know how to do that.

In this article, you are going to learn how to enable automatic software updates on CentOS 8 Linux machine. You are going to learn how to set up your system such that you won’t need to manually install security and other updates.

Set Automatic CentOS 8 Updates Using Automatic RPM Package

The first thing is to install the DNF-automatic RPM package. The package provides a DNF component that starts automatically. To install it, use the following command.

# dnf install dnf-automatic
Install dnf-automatic in CentOS 8
Install dnf-automatic in CentOS 8

You can get more details on the package using the rpm command.

# rpm -qi dnf-automatic
Get Info About dnf-automatic
Get Info About dnf-automatic

Next up is configuring the dnf-automatic updates. The configuration file is located at /etc/dnf/automatic.conf. Once you have opened the file, you can to set the required values to fit your software requirements.

A configuration file looks like the following.

[commands]
upgrade_type = default
random_sleep = 0
download_updates = yes
apply_updates = yes
[emitters]
emit_via = motd
[email]
email_from = root@myserver.example.com
email_to = root
email_host = localhost
[base]
debuglevel = 1

You can set dnf-automatic to only download new updates and alert you via email, but this means you will have to install updates manually. To enable the feature, disable apply_updates in the configuration file.

apply_updates = no

Proceed to set the alert method.

Finally, you can now run dnf-automatic, execute the following command to schedule DNF automatic updates for your CentOS 8 machine.

# systemctl enable --now dnf-automatic.timer
Schedule DNF Automatic Updates on CentOS 8
Schedule DNF Automatic Updates on CentOS 8

The command above enables and starts the system timer. To check the status of the dnf-automatic service, run the following.

# systemctl list-timers *dnf-*
Check DNF Automatic Updates for CentOS 8
Check DNF Automatic Updates for CentOS 8

Set Automatic CentOS 8 Updates Using Cockpit Web Console

The CentOS 8 has a pre-installed Cockpit, which allows the system admin to manage tasks from a web-based console. You can use Cockpit to update the operating system as well as the software.

If Cockpit is not installed, you can install it using our guide: How to Install Cockpit Web Console in CentOS 8.

To do this, log into Cockpit with an admin account by way of https://SERVER_IP:9090 (Where SERVER_IP is the IP address of your CentOS 8 server. Once you’ve logged in, click Software Updates in the left navigation.

Cockpit - Software Updates for CentOS0-8
Cockpit – Software Updates for CentOS0-8

In the next window, turn automatic updates ON. You can now select the type of updates you want (Apply All Updates or Apply Security Updates), the day and time you want the updates applied, and the server rebooted.

Cockpit - Set Automatic CentOS 8 Updates
Cockpit – Set Automatic CentOS 8 Updates

Note that you cannot set up automatic updates without rebooting the system. Therefore, make sure your server can be rebooted at the time you’ve selected for the updates.

Conclusion

In this article, you have learned how to set up automatic updates for your CentOS 8 machine. There are two ways you can do this. The first method is by using DNF automatic updates. The main advantage of enabling DNF automatic updates on CentOS 8 Linux is that your machines get updated faster, uniformly, and frequently as compared to manual updates.

This gives you more leverage against cyber-attacks. The second method is by using the Cockpit web console. With Cockpit, it’s easy to enable automatic updates since you use the graphical user interface (GUI) as opposed to the DNF automatic updates, which use the command-line interface (CLI).

0 (0)
Article Rating (No Votes)
Rate this article
Attachments
There are no attachments for this article.
Comments
There are no comments for this article. Be the first to post a comment.
Full Name
Email Address
Security Code Security Code
Related Articles RSS Feed
Linux Chage Command to Set Password Aging for User
Viewed 2318 times since Tue, Sep 11, 2018
KONTO SFTP Z CHROOTEM Z UŻYCIEM OPENSSH-SERVER NA CENTOS/RHEL6
Viewed 1749 times since Fri, Nov 30, 2018
30 Handy Bash Shell Aliases For Linux / Unix / MacOS
Viewed 4544 times since Thu, Feb 11, 2021
How to use yum-cron to automatically update RHEL/CentOS Linux 6.x / 7.x
Viewed 4923 times since Tue, Dec 4, 2018
Linux – How to check the exit status of several piped commands
Viewed 2874 times since Wed, Jul 25, 2018
ubuntu How to Reset Forgotten Root Password in Ubuntu
Viewed 2706 times since Tue, Dec 8, 2020
Lsyncd: live file syncronization across multiple Linux servers
Viewed 6794 times since Wed, Oct 31, 2018
Tip: SSD and Linux. Enable TRIM and check if it works
Viewed 16887 times since Fri, May 15, 2020
LVM: Extend an existing Volume Group by adding a new disk
Viewed 1981 times since Sat, Jun 2, 2018
Testing TLS/SSL encryption
Viewed 13129 times since Thu, Jan 16, 2020