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

The Geek Diary

CONCEPTS | BASICS | HOWTO

  • OS
    • Linux
    • CentOS/RHEL
    • Solaris
    • Oracle Linux
    • Linux Services
    • VCS
  • Database
    • oracle
    • oracle 12c
    • ASM
    • mysql
    • MariaDB
    • Data Guard
  • DevOps
    • Docker
    • Shell Scripting
  • Interview Questions
  • 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 disable timeout in ssh during login prompt (login session inactivity) in Linux
  2. How To Execute The Pstack Command On CentOS/RHEL
  3. CentOS / RHEL 7 : Booting process
  4. How to Create and Query a BTRFS File System
  5. How to set children-max for udev Service in CentOS/RHEL 7
  6. Yum Command Fails with “Another app is currently holding the yum lock” in CentOS/ RHEL 7
  7. 18 Practical tcpdump Command Examples – A Network Sniffer Tool Primer
  8. TCP Wrapper (hosts.allow & hosts.deny) Command Options in Linux
  9. Linux OS Service ‘named’
  10. Understanding /etc/xinetd.conf file in Linux

You May Also Like

Primary Sidebar

Recent Posts

  • SQL script to find tables that are fragmented
  • TRUNCATE TABLE not releasing space from tablespace
  • How to reclaim entire space of an oracle database table with “Truncate Table” statement
  • Oracle SQL Script to Report Tablespace Free and Fragmentation
  • Archives
  • Contact Us
  • Copyright

© 2021 · The Geek Diary