Setup Automatic Software Updates on CentOS 8 / RHEL 8/ Almalinux 8/ Rocky Linux 8

The below can be pasted in to install dnf-automatic and setup automatic updates and emails from root@hostname all in one go.

It automatically adds in the current hostname so in most cases no edits are needed unless you prefer notifications vs automatic updates.

sudo dnf install -y vim dnf-automatic
tee /etc/dnf/automatic.conf <<EOF
[commands]
upgrade_type = default
random_sleep = 0
download_updates = yes
apply_updates = yes

[emitters]
emit_via = motd

[email]
email_from = root@$(hostname --fqdn)
email_to = root
email_host = localhost

[base]
debuglevel = 1
EOF
sudo systemctl enable --now dnf-automatic.timer

Example:

[root@testalmalinux ~]# sudo dnf install -y vim dnf-automatic
Last metadata expiration check: 0:36:30 ago on Sat 07 Aug 2021 02:16:39 PM UTC.
Dependencies resolved.
==================================================================================================================================
 Package                         Architecture             Version                               Repository                   Size
==================================================================================================================================
Installing:
 dnf-automatic                   noarch                   4.4.2-11.el8                          baseos                      147 k
 vim-enhanced                    x86_64                   2:8.0.1763-15.el8                     appstream                   1.4 M
Installing dependencies:
 gpm-libs                        x86_64                   1.20.7-17.el8                         appstream                    38 k
 vim-common                      x86_64                   2:8.0.1763-15.el8                     appstream                   6.3 M

Transaction Summary
==================================================================================================================================
Install  4 Packages

Total download size: 7.9 M
Installed size: 30 M
Downloading Packages:
(1/4): gpm-libs-1.20.7-17.el8.x86_64.rpm                                                          671 kB/s |  38 kB     00:00    
(2/4): dnf-automatic-4.4.2-11.el8.noarch.rpm                                                      2.1 MB/s | 147 kB     00:00    
(3/4): vim-enhanced-8.0.1763-15.el8.x86_64.rpm                                                     11 MB/s | 1.4 MB     00:00    
(4/4): vim-common-8.0.1763-15.el8.x86_64.rpm                                                       15 MB/s | 6.3 MB     00:00    
----------------------------------------------------------------------------------------------------------------------------------
Total                                                                                             4.9 MB/s | 7.9 MB     00:01     
Running transaction check
Transaction check succeeded.
Running transaction test
Transaction test succeeded.
Running transaction
  Preparing        :                                                                                                          1/1 
  Installing       : vim-common-2:8.0.1763-15.el8.x86_64                                                                      1/4 
  Installing       : gpm-libs-1.20.7-17.el8.x86_64                                                                            2/4 
  Running scriptlet: gpm-libs-1.20.7-17.el8.x86_64                                                                            2/4 
  Installing       : vim-enhanced-2:8.0.1763-15.el8.x86_64                                                                    3/4 
  Installing       : dnf-automatic-4.4.2-11.el8.noarch                                                                        4/4 
  Running scriptlet: dnf-automatic-4.4.2-11.el8.noarch                                                                        4/4 
  Running scriptlet: vim-common-2:8.0.1763-15.el8.x86_64                                                                      4/4 
  Verifying        : dnf-automatic-4.4.2-11.el8.noarch                                                                        1/4 
  Verifying        : gpm-libs-1.20.7-17.el8.x86_64                                                                            2/4 
  Verifying        : vim-common-2:8.0.1763-15.el8.x86_64                                                                      3/4 
  Verifying        : vim-enhanced-2:8.0.1763-15.el8.x86_64                                                                    4/4 

Installed:
  dnf-automatic-4.4.2-11.el8.noarch             gpm-libs-1.20.7-17.el8.x86_64         vim-common-2:8.0.1763-15.el8.x86_64        
  vim-enhanced-2:8.0.1763-15.el8.x86_64        

Complete!
[root@testalmalinux ~]# tee /etc/dnf/automatic.conf <<EOF
> [commands]
> upgrade_type = default
> random_sleep = 0
> download_updates = yes
> apply_updates = yes
> 
> [emitters]
> emit_via = motd
> 
> [email]
> email_from = root@$(hostname --fqdn)
> email_to = root
> email_host = localhost
> 
> [base]
> debuglevel = 1
> EOF
[commands]
upgrade_type = default
random_sleep = 0
download_updates = yes
apply_updates = yes

[emitters]
emit_via = motd

[email]
email_from = root@testalmalinux.whattheserver.com
email_to = root
email_host = localhost

[base]
debuglevel = 1
[root@testalmalinux ~]# sudo systemctl enable --now dnf-automatic.timer
Created symlink /etc/systemd/system/timers.target.wants/dnf-automatic.timer → /usr/lib/systemd/system/dnf-automatic.timer.
[root@testalmalinux ~]# sudo systemctl list-timers *dnf-*
NEXT                         LEFT     LAST PASSED UNIT                ACTIVATES
Sun 2021-08-08 06:40:57 UTC  15h left n/a  n/a    dnf-automatic.timer dnf-automatic.service
n/a                          n/a      n/a  n/a    dnf-makecache.timer dnf-makecache.service

2 timers listed.
Pass --all to see loaded but inactive timers, too.
[root@testalmalinux ~]#

More details on the overall individual things can be found at source reference post for those curious how it works.

73 thoughts on “Setup Automatic Software Updates on CentOS 8 / RHEL 8/ Almalinux 8/ Rocky Linux 8”

  1. Pingback: generic otc viagra
  2. Pingback: flagyl ossiuri
  3. Pingback: 10mg nolvadex
  4. Pingback: furosemide 3
  5. Pingback: metformin shits
  6. Pingback: zoloft and ritalin
  7. Pingback: bactrim dosage
  8. Pingback: augmentin 875/125
  9. Pingback: 1 ml semaglutide
  10. Pingback: acarbose versuch
  11. Pingback: actos dangers
  12. Pingback: rexulti vs abilify

Leave a Comment

Item added to cart.
0 items - $0.00