• 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. nmtui Command Examples in Linux
  2. How to create partitions and file systems on DM-Multipath devices
  3. iw Command Examples in Linux
  4. links: command not found
  5. How to Enable Debug Mode for Chronyd Service in CentOS/RHEL 8
  6. isoinfo Command Examples in Linux
  7. CentOS / RHEL : How to disable root login or root access on a system
  8. finch: command not found
  9. How to install and configure MariaDB in CentOS / RHEL 7
  10. Understanding SELinux Policies in Linux

You May Also Like

Primary Sidebar

Recent Posts

  • pw-cat Command Examples in Linux
  • pvs: command not found
  • pulseaudio: command not found
  • pulseaudio Command Examples in Linux

© 2023 · The Geek Diary

  • Archives
  • Contact Us
  • Copyright