• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar
  • Skip to footer navigation

The Geek Diary

  • OS
    • Linux
    • CentOS/RHEL
    • Solaris
    • Oracle Linux
    • VCS
  • Interview Questions
  • Database
    • oracle
    • oracle 12c
    • ASM
    • mysql
    • MariaDB
  • DevOps
    • Docker
    • Shell Scripting
  • Big Data
    • Hadoop
    • Cloudera
    • Hortonworks HDP

How to Configure Automatic Package Updates on the Server in CentOS/RHEL 8

by admin

It is always advisable to keep the installed packages up to date, especially when it comes to security. In this post, we will see how to setup Automatic Update using the dnf-automatic tool.

DNF tool provides automatic notifications of updates, download updates, and then install them automatically by using systemd timers. Below are three systemd timer units provided by dnf-automatic.

  • dnf-automatic-notifyonly.timer: Notifies for available updates.
  • dnf-automatic-download.timer: Downloads package updates, but does not install them.
  • dnf-automatic-install.timer: Downloads and automatically installs package updates.

The dnf-automatic package is not installed by default on the Linux server, it’s available on the BaseOS repository.

1. Install the dnf-automatic package using the below command:

# dnf install dnf-automatic

2. Configure the DNF Automatic tool by editing the /etc/dnf/automatic.conf configuration file. For example:

# vi /etc/dnf/automatic.conf
[commands]
upgrade_type = default

On the ‘[commands]‘ section, change the ‘upgrade_type‘ as per the need. You can use ‘default‘ for upgrading all available packages or use the ‘security‘ option to upgrade only security related packages.

3. Enable the systemd dnf-automatic.timer timer unit to start using this service:

# systemctl enable --now dnf-automatic.timer

4. Check the status of the dnf-automatic timer

# systemctl list-timers *dnf-*
NEXT LEFT LAST PASSED UNIT ACTIVATES
Mon 2020-12-21 14:30:10 IST 55min left Mon 2020-12-21 13:30:05 IST 4min 49s ago dnf-makecache.timer dnf-makecache.service
Tue 2020-12-22 06:36:59 IST 17h left Mon 2020-12-21 12:19:37 IST 1h 15min ago dnf-automatic.timer dnf-automatic.service

Here, the dnf-makecache unit will run the dnf-makecache service for updating cache packages, and the dnf-automatic unit will run the dnf-automatic service for downloading package upgrades.

5. For the automatic installation of package upgrades, run the ‘dnf-automatic-install‘ timer service.

# systemctl enable --now dnf-automatic-install.timer
Note: Additional alternate timer units which are available can override the default configuration that is specified in the configuration file when enabled.

Filed Under: CentOS/RHEL, CentOS/RHEL 8, Linux

Some more articles you might also be interested in …

  1. How to Recover Corrupted Root Partition from Rescue Mode in CentOS/RHEL 5,6
  2. A little trick: select a random file or line in the file with shuf
  3. How to Access VNC Server Through A Web Browser in Linux
  4. mdadm Command Shows State : active, degraded
  5. Troubleshooting common NFS issues in Linux
  6. ASMLib-Managed Disks on Multipathed iSCSI Targets are not Discovered after Server Reboot in CentOS/RHEL 7
  7. How to Configure Persistent Names for Tape Devices in CentOS/RHEL
  8. Beginners Guide to Tuning Profiles in CentOS/RHEL
  9. How to configure the logging of failed login attempts for vsftpd
  10. How to format code within web pages

You May Also Like

Primary Sidebar

Recent Posts

  • grpck command – Remove corrupt or duplicate entries in the /etc/group and /etc/gshadow files.
  • xxd command – Expressed in hexadecimal form
  • sesearch: command not found
  • macof: command not found

© 2022 · The Geek Diary

  • Archives
  • Contact Us
  • Copyright